Skip to content

Commit

Permalink
Add asserts to remaining tests in TypeConversionTest
Browse files Browse the repository at this point in the history
  • Loading branch information
seanrobbins committed Jan 20, 2018
1 parent 803c36e commit 8bd9ccc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/test/java/org/tron/utils/TypeConversionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
}

0 comments on commit 8bd9ccc

Please sign in to comment.