优化代码
This commit is contained in:
1 parent
ed738d3da6
commit
4048428169
14 files changed
+381
-309
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/** TRON 金额最小单位和广播结果校验测试。 */
|
||||
public class TronServiceSupportTest {
|
||||
@Test
|
||||
public void shouldConvertSixDecimalAmountExactly() {
|
||||
Assert.assertEquals(1234567L,
|
||||
TronServiceSupport.toSun(new BigDecimal("1.234567"), "amount"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void shouldRejectAmountWithMoreThanSixDecimals() {
|
||||
TronServiceSupport.toSun(new BigDecimal("1.0000001"), "amount");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void shouldRejectNonPositiveAmount() {
|
||||
TronServiceSupport.toSun(BigDecimal.ZERO, "amount");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void shouldRejectErrorTextAsTransactionHash() {
|
||||
TronServiceSupport.requireTransactionHash("error_insufficient balance");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnValidTransactionHash() {
|
||||
Assert.assertEquals("abc123", TronServiceSupport.requireTransactionHash("abc123"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user