@Test
public void testPositionBug() {

	final String FIRST = "First line";
	final String SECOND = "Second line";
	
	try {
		// create input file
		File tempFile = File.createTempFile("TextInputFormatTest", "tmp");
		tempFile.deleteOnExit();
		tempFile.setWritable(true);
		
		FileWriter writer = new FileWriter(tempFile);
		writer.append(FIRST).append('\n');
		writer.append(SECOND).append('\n');
		writer.close();
		
		TextInputFormat inputFormat = new TextInputFormat();
		inputFormat.setFilePath(tempFile.toURI().toString());
		
		Configuration parameters = new Configuration(); 
		inputFormat.configure(parameters);
		
		FileInputSplit[] splits = inputFormat.createInputSplits(1);
		assertTrue("expected at least one input split", splits.length >= 1);
		
		inputFormat.open(splits[0]);
		
		Record r = new Record();
		assertNotNull("Expecting first record here", inputFormat.nextRecord(r));
		assertEquals(FIRST, r.getField(0, StringValue.class).getValue());
		
		assertNotNull("Expecting second record here",inputFormat.nextRecord(r ));
		assertEquals(SECOND, r.getField(0, StringValue.class).getValue());
		
		assertNull("The input file is over", inputFormat.nextRecord(r));
	}
	catch (Throwable t) {
		System.err.println("test failed with exception: " + t.getMessage());
		t.printStackTrace(System.err);
		fail("Test erroneous");
	}
}