diff --git a/src/test/java/org/tron/utils/TypeConversionTest.java b/src/test/java/org/tron/utils/TypeConversionTest.java index 3e34591fcb5..f5b118a1db1 100644 --- a/src/test/java/org/tron/utils/TypeConversionTest.java +++ b/src/test/java/org/tron/utils/TypeConversionTest.java @@ -15,6 +15,7 @@ package org.tron.utils; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.tron.common.utils.TypeConversion.bytesToHexString; import static org.tron.common.utils.TypeConversion.bytesToLong; @@ -34,25 +35,28 @@ public class TypeConversionTest { @Test public void testLongToBytes() { byte[] result = longToBytes(123L); - assertTrue(Arrays.equals(result, new byte[]{0, 0, 0, 0, 0, 0, 0, 123})); + assertTrue(Arrays.equals(new byte[]{0, 0, 0, 0, 0, 0, 0, 123}, result)); logger.info("long 123 to bytes is: {}", result); } @Test public void testBytesToLong() { long result = bytesToLong(new byte[]{0, 0, 0, 0, 0, 0, 0, 124}); + assertEquals(124L, result); logger.info("bytes 124 to long is: {}", result); } @Test public void testBytesToHexString() { String result = bytesToHexString(new byte[]{0, 0, 0, 0, 0, 0, 0, 125}); + assertEquals("000000000000007d", result); logger.info("bytes 125 to hex string is: {}", result); } @Test public void testHexStringToBytes() { byte[] result = hexStringToBytes("7f"); + assertTrue(Arrays.equals(new byte[]{127}, result)); logger.info("hex string 7f to bytes is: {}", result); } }