Skip to content

Commit 4063338

Browse files
committed
Sort test methods.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1637889 13f79535-47bb-0310-9956-ffa450edef68
1 parent c5154bc commit 4063338

1 file changed

Lines changed: 55 additions & 55 deletions

File tree

src/test/java/org/apache/commons/codec/binary/HexTest.java

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,8 @@ public void testDecodeByteArrayEmpty() throws DecoderException {
206206
}
207207

208208
@Test
209-
public void testDecodeByteBufferEmpty() throws DecoderException {
210-
assertTrue(Arrays.equals(new byte[0], new Hex().decode(ByteBuffer.allocate(0))));
211-
}
212-
213-
@Test
214-
public void testDecodeCharArrayEmpty() throws DecoderException {
215-
assertTrue(Arrays.equals(new byte[0], Hex.decodeHex(new char[0])));
209+
public void testDecodeByteArrayObjectEmpty() throws DecoderException {
210+
assertTrue(Arrays.equals(new byte[0], (byte[]) new Hex().decode((Object) new byte[0])));
216211
}
217212

218213
@Test
@@ -225,6 +220,16 @@ public void testDecodeByteArrayOddCharacters() {
225220
}
226221
}
227222

223+
@Test
224+
public void testDecodeByteBufferEmpty() throws DecoderException {
225+
assertTrue(Arrays.equals(new byte[0], new Hex().decode(ByteBuffer.allocate(0))));
226+
}
227+
228+
@Test
229+
public void testDecodeByteBufferObjectEmpty() throws DecoderException {
230+
assertTrue(Arrays.equals(new byte[0], (byte[]) new Hex().decode((Object) ByteBuffer.allocate(0))));
231+
}
232+
228233
@Test
229234
public void testDecodeByteBufferOddCharacters() {
230235
ByteBuffer buffer = ByteBuffer.allocate(1);
@@ -237,6 +242,11 @@ public void testDecodeByteBufferOddCharacters() {
237242
}
238243
}
239244

245+
@Test
246+
public void testDecodeCharArrayEmpty() throws DecoderException {
247+
assertTrue(Arrays.equals(new byte[0], Hex.decodeHex(new char[0])));
248+
}
249+
240250
@Test
241251
public void testDecodeClassCastException() {
242252
try {
@@ -278,13 +288,23 @@ public void testDecodeStringEmpty() throws DecoderException {
278288
}
279289

280290
@Test
281-
public void testDecodeByteArrayObjectEmpty() throws DecoderException {
282-
assertTrue(Arrays.equals(new byte[0], (byte[]) new Hex().decode((Object) new byte[0])));
291+
public void testEncodeByteArrayEmpty() throws EncoderException {
292+
assertTrue(Arrays.equals(new byte[0], new Hex().encode(new byte[0])));
283293
}
284294

285295
@Test
286-
public void testDecodeByteBufferObjectEmpty() throws DecoderException {
287-
assertTrue(Arrays.equals(new byte[0], (byte[]) new Hex().decode((Object) ByteBuffer.allocate(0))));
296+
public void testEncodeByteArrayObjectEmpty() throws EncoderException {
297+
assertTrue(Arrays.equals(new char[0], (char[]) new Hex().encode((Object) new byte[0])));
298+
}
299+
300+
@Test
301+
public void testEncodeByteBufferEmpty() throws EncoderException {
302+
assertTrue(Arrays.equals(new byte[0], new Hex().encode(ByteBuffer.allocate(0))));
303+
}
304+
305+
@Test
306+
public void testEncodeByteBufferObjectEmpty() throws EncoderException {
307+
assertTrue(Arrays.equals(new char[0], (char[]) new Hex().encode((Object) ByteBuffer.allocate(0))));
288308
}
289309

290310
@Test
@@ -336,12 +356,6 @@ public void testEncodeHexByteArrayEmpty() throws EncoderException {
336356
assertTrue(Arrays.equals(new byte[0], new Hex().encode(new byte[0])));
337357
}
338358

339-
@Test
340-
public void testEncodeHexByteBufferEmpty() throws EncoderException {
341-
assertTrue(Arrays.equals(new char[0], Hex.encodeHex(ByteBuffer.allocate(0))));
342-
assertTrue(Arrays.equals(new byte[0], new Hex().encode(ByteBuffer.allocate(0))));
343-
}
344-
345359
@Test
346360
public void testEncodeHexByteArrayHelloWorldLowerCaseHex() {
347361
final byte[] b = StringUtils.getBytesUtf8("Hello World");
@@ -356,29 +370,41 @@ public void testEncodeHexByteArrayHelloWorldLowerCaseHex() {
356370
}
357371

358372
@Test
359-
public void testEncodeHexByteBufferHelloWorldLowerCaseHex() {
360-
final ByteBuffer b = StringUtils.getByteBufferUtf8("Hello World");
361-
final String expected = "48656c6c6f20576f726c64";
373+
public void testEncodeHexByteArrayHelloWorldUpperCaseHex() {
374+
final byte[] b = StringUtils.getBytesUtf8("Hello World");
375+
final String expected = "48656C6C6F20576F726C64";
362376
char[] actual;
363377
actual = Hex.encodeHex(b);
364-
assertEquals(expected, new String(actual));
378+
assertFalse(expected.equals(new String(actual)));
365379
actual = Hex.encodeHex(b, true);
366-
assertEquals(expected, new String(actual));
367-
actual = Hex.encodeHex(b, false);
368380
assertFalse(expected.equals(new String(actual)));
381+
actual = Hex.encodeHex(b, false);
382+
assertTrue(expected.equals(new String(actual)));
369383
}
370384

371385
@Test
372-
public void testEncodeHexByteArrayHelloWorldUpperCaseHex() {
373-
final byte[] b = StringUtils.getBytesUtf8("Hello World");
374-
final String expected = "48656C6C6F20576F726C64";
386+
public void testEncodeHexByteArrayZeroes() {
387+
final char[] c = Hex.encodeHex(new byte[36]);
388+
assertEquals("000000000000000000000000000000000000000000000000000000000000000000000000", new String(c));
389+
}
390+
391+
@Test
392+
public void testEncodeHexByteBufferEmpty() throws EncoderException {
393+
assertTrue(Arrays.equals(new char[0], Hex.encodeHex(ByteBuffer.allocate(0))));
394+
assertTrue(Arrays.equals(new byte[0], new Hex().encode(ByteBuffer.allocate(0))));
395+
}
396+
397+
@Test
398+
public void testEncodeHexByteBufferHelloWorldLowerCaseHex() {
399+
final ByteBuffer b = StringUtils.getByteBufferUtf8("Hello World");
400+
final String expected = "48656c6c6f20576f726c64";
375401
char[] actual;
376402
actual = Hex.encodeHex(b);
377-
assertFalse(expected.equals(new String(actual)));
403+
assertEquals(expected, new String(actual));
378404
actual = Hex.encodeHex(b, true);
379-
assertFalse(expected.equals(new String(actual)));
405+
assertEquals(expected, new String(actual));
380406
actual = Hex.encodeHex(b, false);
381-
assertTrue(expected.equals(new String(actual)));
407+
assertFalse(expected.equals(new String(actual)));
382408
}
383409

384410
@Test
@@ -394,12 +420,6 @@ public void testEncodeHexByteBufferHelloWorldUpperCaseHex() {
394420
assertTrue(expected.equals(new String(actual)));
395421
}
396422

397-
@Test
398-
public void testEncodeHexByteArrayZeroes() {
399-
final char[] c = Hex.encodeHex(new byte[36]);
400-
assertEquals("000000000000000000000000000000000000000000000000000000000000000000000000", new String(c));
401-
}
402-
403423
@Test
404424
public void testEncodeHexByteBufferZeroes() {
405425
final char[] c = Hex.encodeHex(ByteBuffer.allocate(36));
@@ -421,26 +441,6 @@ public void testGetCharsetName() throws UnsupportedEncodingException, DecoderExc
421441
Assert.assertEquals(Charsets.UTF_8.name(), new Hex(Charsets.UTF_8).getCharsetName());
422442
}
423443

424-
@Test
425-
public void testEncodeByteArrayEmpty() throws EncoderException {
426-
assertTrue(Arrays.equals(new byte[0], new Hex().encode(new byte[0])));
427-
}
428-
429-
@Test
430-
public void testEncodeByteArrayObjectEmpty() throws EncoderException {
431-
assertTrue(Arrays.equals(new char[0], (char[]) new Hex().encode((Object) new byte[0])));
432-
}
433-
434-
@Test
435-
public void testEncodeByteBufferEmpty() throws EncoderException {
436-
assertTrue(Arrays.equals(new byte[0], new Hex().encode(ByteBuffer.allocate(0))));
437-
}
438-
439-
@Test
440-
public void testEncodeByteBufferObjectEmpty() throws EncoderException {
441-
assertTrue(Arrays.equals(new char[0], (char[]) new Hex().encode((Object) ByteBuffer.allocate(0))));
442-
}
443-
444444
@Test
445445
public void testRequiredCharset() throws UnsupportedEncodingException, DecoderException {
446446
testCustomCharset("UTF-8", "testRequiredCharset");

0 commit comments

Comments
 (0)