|
34 | 34 | import java.util.Set;
|
35 | 35 |
|
36 | 36 | import static com.esaulpaugh.headlong.TestUtils.assertThrown;
|
| 37 | +import static com.esaulpaugh.headlong.rlp.KVP.CLIENT; |
37 | 38 | import static com.esaulpaugh.headlong.rlp.KVP.EMPTY_ARRAY;
|
38 | 39 | import static com.esaulpaugh.headlong.rlp.KVP.ID;
|
39 | 40 | import static com.esaulpaugh.headlong.rlp.KVP.IP;
|
@@ -340,11 +341,10 @@ public byte[] sign(byte[] content) {
|
340 | 341 |
|
341 | 342 | @Test
|
342 | 343 | public void testDuplicateKeys() throws Throwable {
|
343 |
| - byte[] keyBytes = new byte[0]; |
344 |
| - final List<KVP> pairs = Arrays.asList(new KVP(keyBytes, new byte[0]), new KVP(keyBytes, new byte[1])); |
| 344 | + final List<KVP> pairs = Arrays.asList(new KVP("", new byte[0]), new KVP("", new byte[1])); |
345 | 345 | assertThrown(IllegalArgumentException.class, "duplicate key", () -> pairs.sort(Comparator.naturalOrder()));
|
346 | 346 |
|
347 |
| - final List<KVP> pairs2 = Arrays.asList(new KVP(new byte[] { 2 }, new byte[0]), new KVP(new byte[] { 2 }, new byte[1])); |
| 347 | + final List<KVP> pairs2 = Arrays.asList(new KVP("d", new byte[0]), new KVP("d", new byte[1])); |
348 | 348 | assertThrown(IllegalArgumentException.class, "duplicate key", () -> pairs2.sort(Comparator.naturalOrder()));
|
349 | 349 | }
|
350 | 350 |
|
@@ -476,6 +476,9 @@ public void testOutOfOrder() throws Throwable {
|
476 | 476 | @Test
|
477 | 477 | public void testToString() {
|
478 | 478 | assertEquals("ip --> 3235352e3130312e302e313238", new KVP(IP, "255.101.0.128", ASCII).toString());
|
479 |
| - assertEquals("client --> [\"dd\", \"\"]", new KVP(KVP.CLIENT, RLPDecoder.RLP_STRICT.wrapBits(0xc482646480L)).toString()); |
| 479 | + assertEquals( |
| 480 | + "client --> [\"dd\", \"\"]", |
| 481 | + new KVP(RLPDecoder.RLP_STRICT.wrapString(RLPEncoder.string(Strings.decode(CLIENT, UTF_8))), RLPDecoder.RLP_STRICT.wrapBits(0xc482646480L)).toString() |
| 482 | + ); |
480 | 483 | }
|
481 | 484 | }
|
0 commit comments