Exemple #1
0
 @Test
 public void testHappyPath() throws FeederException {
   StringReader reader = new StringReader("10.11.12.13 10.11.12.14 10.11.12.15");
   FileFeeder fileFeeder = new FileFeeder(reader);
   assertTrue(fileFeeder.hasNext());
   assertEquals("10.11.12.13", fileFeeder.next().getAddress().getHostAddress());
   assertTrue(fileFeeder.hasNext());
   assertEquals("10.11.12.14", fileFeeder.next().getAddress().getHostAddress());
   assertTrue(fileFeeder.hasNext());
   assertEquals("10.11.12.15", fileFeeder.next().getAddress().getHostAddress());
   assertFalse(fileFeeder.hasNext());
 }
Exemple #2
0
 private void assertAddressCount(String s, int addressCount) {
   StringReader reader = new StringReader(s);
   FileFeeder feeder = new FileFeeder(reader);
   int numAddresses = 0;
   while (feeder.hasNext()) {
     feeder.next();
     numAddresses++;
   }
   assertEquals(addressCount, numAddresses);
 }