@Test public void testReadTwoLines() throws IOException { input.addChunk( "ma che bel castello marcondirondirondello!\r\nMiaoMiaoMiaoooooo\r\n".getBytes()); input.precacheDataFromRemote(); assertEquals("ma che bel castello marcondirondirondello!\r\n", input.readTextLine()); assertFalse(input.noDataAvailable()); assertEquals("MiaoMiaoMiaoooooo\r\n", input.readTextLine()); assertTrue(input.noDataAvailable()); }
@Test public void testReadOneLineAndGarbage() throws IOException { input.addChunk("ma che bel castello marcondirondirondello!\r\nMiaoMiaoMiaoooooo".getBytes()); input.precacheDataFromRemote(); assertEquals("ma che bel castello marcondirondirondello!\r\n", input.readTextLine()); assertFalse(input.noDataAvailable()); assertEquals("MiaoMiaoMiaoooooo", new String(input.getBytes(17))); }