String inputString = line1 + "\r\n" + line2;
NewLineReader r = new NewLineReader(new StringReader(inputString), null, "\n");
LineIterator i = r.iterateLines();
Assert.assertEquals(i.nextLine(), line1);
Assert.assertEquals(r.getInputNewLine(), "\r\n");
Assert.assertEquals(r.getOutputNewLine(), "\n");
Assert.assertEquals(i.nextLine(), line2);
Assert.assertFalse(i.hasNext()); // Should not return another line (LineIterator behavior)