Commit 514a1d83 authored by John Bergqvist's avatar John Bergqvist Committed by kezhenxu94

Add unit tests for com.ctrip.framework.apollo.core.utils.ByteUtil (#2367)

parent 6cd6bc5c
package com.ctrip.framework.apollo.core.utils;
import com.ctrip.framework.apollo.core.utils.ByteUtil;
import org.junit.Assert;
import org.junit.Test;
public class ByteUtilTest {
@Test
public void testInt3() {
Assert.assertEquals((byte)0, ByteUtil.int3(0));
Assert.assertEquals((byte)0, ByteUtil.int3(1));
}
@Test
public void testInt2() {
Assert.assertEquals((byte)0, ByteUtil.int2(0));
Assert.assertEquals((byte)0, ByteUtil.int2(1));
}
@Test
public void testInt1() {
Assert.assertEquals((byte)0, ByteUtil.int1(0));
Assert.assertEquals((byte)0, ByteUtil.int1(1));
}
@Test
public void testInt0() {
Assert.assertEquals((byte)0, ByteUtil.int0(0));
Assert.assertEquals((byte)1, ByteUtil.int0(1));
}
@Test
public void testToHexString() {
Assert.assertEquals("", ByteUtil.toHexString(new byte[] {}));
Assert.assertEquals("98", ByteUtil.toHexString(new byte[] {(byte)-104}));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment