32333435363738394041
BencodeData.createBencodeData(new Date()); } @Test public void testIntCreationFromObject () { BencodeData d = BencodeData.createBencodeData(1L); assertEquals(BencodeType.INT, d.getType()); assertEquals(1L, d.getInt()); assertEquals(1L, d.get()); }
40414243444546474849
assertEquals(1L, d.get()); } @Test public void testStringCreationFromObject () { BencodeData d = BencodeData.createBencodeData("abc"); assertEquals(BencodeType.STRING, d.getType()); assertEquals("abc", d.getString()); assertEquals("abc", d.get()); }
302303304305306307308309310311312313
if (EventType.LIST == r.getEventType()) { List<BencodeData> list = r.getList(); for (BencodeData bencodeData : list) { if (BencodeType.LIST != bencodeData.getType()) { List<BencodeData> innerList = r.getList(); BencodeData num = innerList.get(0); assertEquals(intValuesExpected[decodedIntIndex++], num.getInt()); } } } } }
344345346347348349350351352353
BencodeStreamReader r = f.createBencodeStreamReader(s); while(r.hasNext()) { r.next(); Map<String, BencodeData> dict = r.getDict(); BencodeData value = dict.get("cat"); assertEquals("black", value.getString()); } } }