@@ -43,17 +43,18 @@ public void testLongToUint32Bytes() {
4343 public void testIntToBytes () {
4444 int toParse = 5717 ;
4545 byte [] result = ArrayConverter .intToBytes (toParse , 2 );
46- assertArrayEquals ("The conversion result of 5717 should be {0x16} {0x55}" , new byte []{ 0x16 , 0x55 }, result );
46+ assertArrayEquals ("The conversion result of 5717 should be {0x16} {0x55}" , new byte [] { 0x16 , 0x55 }, result );
4747 }
4848
4949 /**
5050 * Test of bytesToInt method, of class ArrayConverter.
5151 */
5252 @ Test
5353 public void testBytesToInt () {
54- byte [] toParse = {0x16 , 0x55 };
54+ byte [] toParse = { 0x16 , 0x55 };
5555 int expectedResult = 5717 ;
56- assertEquals ("The conversion result of {0x16, 0x55} should be 5717" , expectedResult , ArrayConverter .bytesToInt (toParse ));
56+ assertEquals ("The conversion result of {0x16, 0x55} should be 5717" , expectedResult ,
57+ ArrayConverter .bytesToInt (toParse ));
5758 }
5859
5960 /**
@@ -76,17 +77,17 @@ public void testBytesToLong() {
7677 */
7778 @ Test
7879 public void testBytesToHexString_byteArr () {
79- byte [] toTest = new byte []{ 0x00 , 0x11 , 0x22 , 0x33 , 0x44 };
80+ byte [] toTest = new byte [] { 0x00 , 0x11 , 0x22 , 0x33 , 0x44 };
8081 assertEquals ("00 11 22 33 44" , ArrayConverter .bytesToHexString (toTest ));
81- toTest = new byte []{ 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 };
82+ toTest = new byte [] { 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 };
8283 assertEquals ("00 01 02 03 04 05 06 07 08" , ArrayConverter .bytesToHexString (toTest ));
83- toTest = new byte []{ 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 , 0x10 };
84+ toTest = new byte [] { 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 , 0x10 };
8485 assertEquals ("00 01 02 03 04 05 06 07 08 09 10" , ArrayConverter .bytesToHexString (toTest ));
85- toTest = new byte []{ 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 ,
86- 0x07 ,};
86+ toTest = new byte [] { 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 ,
87+ 0x07 , };
8788 assertEquals ("\n 00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07" , ArrayConverter .bytesToHexString (toTest ));
88- toTest = new byte []{ 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 ,
89- 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 ,};
89+ toTest = new byte [] { 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 ,
90+ 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , };
9091 assertEquals (
9192 "\n 00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07\n 00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07" ,
9293 ArrayConverter .bytesToHexString (toTest ));
@@ -97,6 +98,14 @@ public void testBytesToHexString_byteArr() {
9798 */
9899 @ Test
99100 public void testBytesToHexString_byteArr_boolean () {
101+ byte [] toTest = new byte [] { 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 ,
102+ 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 ,
103+ 0x06 , 0x07 };
104+ assertEquals ("00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07" ,
105+ ArrayConverter .bytesToHexString (toTest , false ));
106+ assertEquals (
107+ "\n 00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07\n 00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07" ,
108+ ArrayConverter .bytesToHexString (toTest , true ));
100109 }
101110
102111 /**
@@ -106,6 +115,18 @@ public void testBytesToHexString_byteArr_boolean() {
106115 public void testBytesToHexString_3args () {
107116 }
108117
118+ /**
119+ * Test ArrayConverter.bytesToRawHexString().
120+ */
121+ @ Test
122+ public void testBytesToRawHexString () {
123+ byte [] toTest = new byte [] { 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 ,
124+ 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 ,
125+ 0x06 , 0x07 };
126+ assertEquals ("0001020304050607000102030405060700010203040506070001020304050607" ,
127+ ArrayConverter .bytesToRawHexString (toTest ));
128+ }
129+
109130 /**
110131 * Test of concatenate method, of class ArrayConverter.
111132 */
@@ -154,13 +175,13 @@ public void testConvertListToArray() {
154175 @ Test
155176 public void testHexStringToByteArray () {
156177 String hex = "01" ;
157- assertArrayEquals ("Testing simple one byte hex value" , new byte []{ 0x01 },
178+ assertArrayEquals ("Testing simple one byte hex value" , new byte [] { 0x01 },
158179 ArrayConverter .hexStringToByteArray (hex ));
159180 hex = "FF" ;
160- assertArrayEquals ("Testing one byte hex value > 0x7f" , new byte []{ (byte ) 0xff },
181+ assertArrayEquals ("Testing one byte hex value > 0x7f" , new byte [] { (byte ) 0xff },
161182 ArrayConverter .hexStringToByteArray (hex ));
162183 hex = "FFFFFF" ;
163- assertArrayEquals ("Testing one byte hex value > 0x7f" , new byte []{ (byte ) 0xff , (byte ) 0xff , (byte ) 0xff },
184+ assertArrayEquals ("Testing one byte hex value > 0x7f" , new byte [] { (byte ) 0xff , (byte ) 0xff , (byte ) 0xff },
164185 ArrayConverter .hexStringToByteArray (hex ));
165186 }
166187
@@ -170,7 +191,7 @@ public void testBigIntegerToNullPaddedByteArray() {
170191
171192 assertArrayEquals ("Check zero output size" , new byte [0 ],
172193 ArrayConverter .bigIntegerToNullPaddedByteArray (test , 0 ));
173- assertArrayEquals ("Check check output size smaller than input" , new byte []{ (byte ) 0xEC },
194+ assertArrayEquals ("Check check output size smaller than input" , new byte [] { (byte ) 0xEC },
174195 ArrayConverter .bigIntegerToNullPaddedByteArray (test , 1 ));
175196 assertArrayEquals ("Check output size bigger than input size" ,
176197 ArrayConverter .hexStringToByteArray ("0000000000000000000000001D42C86F7923DFEC" ),
0 commit comments