assertFalse(underTest.shouldContinue());
}
public void testGetNext() throws IOException, InterruptedException
{
SequenceFileRecordReader reader = EasyMock.createMock(SequenceFileRecordReader.class);
EasyMock.expect(reader.nextKeyValue()).andReturn(true);
EasyMock.expect(reader.getCurrentKey()).andReturn(new Text("mykey1"));
EasyMock.expect(reader.getCurrentValue()).andReturn(new BytesWritable("test123".getBytes()));
EasyMock.replay(reader);
underTest.script = "src/test/resources/echo.sh";
underTest.prepareToRead(reader, null);
Tuple tuple = underTest.getNext();
assertEquals(4, tuple.size());
assertEquals(tuple.get(0), new Text("mykey1"));
assertEquals(tuple.get(1), new BytesWritable("test123".getBytes()));
assertEquals(tuple.get(2), new File(underTest.dataDir, "mykey1").getAbsolutePath()+"\n");
assertEquals(tuple.get(3), false);
// returns null when no more tuples are available
reader = EasyMock.createMock(SequenceFileRecordReader.class);
EasyMock.expect(reader.nextKeyValue()).andReturn(false);
EasyMock.replay(reader);
underTest.reader = reader;
tuple = underTest.getNext();
assertNull(tuple);