Buggy code:
public class TailerTest extends FileBasedTestCase { private Tailer tailer ; public TailerTest ( final String name ) { } @ Override protected void tearDown ( ) throws Exception { } public void testLongFile ( ) throws Exception { } public void testBufferBreak ( ) throws Exception { } public void testTailerEof ( ) throws Exception { } public void testTailer ( ) throws Exception { final long delayMillis = 50 ; final File file = new File ( getTestDirectory ( ) , "tailer1-test.txt" ) ; createFile ( file , 0 ) ; final TailerTest . TestTailerListener listener = new TailerTest . TestTailerListener ( ) ; final String osname = System . getProperty ( "os.name" ) ; final boolean isWindows = osname . startsWith ( "Windows" ) ; tailer = new Tailer ( file , listener , delayMillis , false , isWindows ) ; final Thread thread = new Thread ( tailer ) ; thread . start ( ) ; write ( file , "Line<seq2seq4repair_space>one" , "Line<seq2seq4repair_space>two" ) ; final long testDelayMillis = delayMillis * 10 ; Thread . sleep ( testDelayMillis ) ; List < String > lines = listener . getLines ( ) ; assertEquals ( "1<seq2seq4repair_space>line<seq2seq4repair_space>count" , 2 , lines . size ( ) ) ; assertEquals ( "1<seq2seq4repair_space>line<seq2seq4repair_space>1" , "Line<seq2seq4repair_space>one" , lines . get ( 0 ) ) ; assertEquals ( "1<seq2seq4repair_space>line<seq2seq4repair_space>2" , "Line<seq2seq4repair_space>two" , lines . get ( 1 ) ) ; listener . clear ( ) ; write ( file , "Line<seq2seq4repair_space>three" ) ; Thread . sleep ( testDelayMillis ) ; lines = listener . getLines ( ) ; assertEquals ( "2<seq2seq4repair_space>line<seq2seq4repair_space>count" , 1 , lines . size ( ) ) ; assertEquals ( "2<seq2seq4repair_space>line<seq2seq4repair_space>3" , "Line<seq2seq4repair_space>three" , lines . get ( 0 ) ) ; listener . clear ( ) ; lines = FileUtils . readLines ( file ) ; assertEquals ( "3<seq2seq4repair_space>line<seq2seq4repair_space>count" , 3 , lines . size ( ) ) ; assertEquals ( "3<seq2seq4repair_space>line<seq2seq4repair_space>1" , "Line<seq2seq4repair_space>one" , lines . get ( 0 ) ) ; assertEquals ( "3<seq2seq4repair_space>line<seq2seq4repair_space>2" , "Line<seq2seq4repair_space>two" , lines . get ( 1 ) ) ; assertEquals ( "3<seq2seq4repair_space>line<seq2seq4repair_space>3" , "Line<seq2seq4repair_space>three" , lines . get ( 2 ) ) ; file . delete ( ) ; final boolean exists = file . exists ( ) ; assertFalse ( "File<seq2seq4repair_space>should<seq2seq4repair_space>not<seq2seq4repair_space>exist" , exists ) ; createFile ( file , 0 ) ; Thread . sleep ( testDelayMillis ) ; write ( file , "Line<seq2seq4repair_space>four" ) ; Thread . sleep ( testDelayMillis ) ; lines = listener . getLines ( ) ; assertEquals ( "4<seq2seq4repair_space>line<seq2seq4repair_space>count" , 1 , lines . size ( ) ) ; assertEquals ( "4<seq2seq4repair_space>line<seq2seq4repair_space>3" , "Line<seq2seq4repair_space>four" , lines . get ( 0 ) ) ; listener . clear ( ) ; tailer . stop ( ) ; tailer = null ; thread . interrupt ( ) ; <START_BUG> Thread . sleep ( testDelayMillis ) ; <END_BUG> write ( file , "Line<seq2seq4repair_space>five" ) ; assertEquals ( "4<seq2seq4repair_space>line<seq2seq4repair_space>count" , 0 , listener . getLines ( ) . size ( ) ) ; assertNotNull ( "Missing<seq2seq4repair_space>InterruptedException" , listener . exception ) ; assertTrue ( ( "Unexpected<seq2seq4repair_space>Exception:<seq2seq4repair_space>" + ( listener . exception ) ) , ( ( listener . exception ) instanceof InterruptedException ) ) ; assertEquals ( "Expected<seq2seq4repair_space>init<seq2seq4repair_space>to<seq2seq4repair_space>be<seq2seq4repair_space>called" , 1 , listener . initialised ) ; assertEquals ( "fileNotFound<seq2seq4repair_space>should<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>called" , 0 , listener . notFound ) ; assertEquals ( "fileRotated<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>be<seq2seq4repair_space>called" , 1 , listener . rotated ) ; } @ Override protected void createFile ( final File file , final long size ) throws IOException { } private void write ( final File file , final String ... lines ) throws Exception { } private void writeString ( final File file , final String ... strings ) throws Exception { } public void testStopWithNoFile ( ) throws Exception { } public void testInterrupt ( ) throws Exception { } public void testStopWithNoFileUsingExecutor ( ) throws Exception { } public void testIO335 ( ) throws Exception { } private static class TestTailerListener implements TailerListener { private final List < String > lines = Collections . synchronizedList ( new ArrayList < String > ( ) ) ; volatile Exception exception = null ; volatile int notFound = 0 ; volatile int rotated = 0 ; volatile int initialised = 0 ; public void handle ( final String line ) { } public List < String > getLines ( ) { } public void clear ( ) { } public void handle ( final Exception e ) { } public void init ( final Tailer tailer ) { } public void fileNotFound ( ) { } public void fileRotated ( ) { } } }

Fix:
Thread . sleep ( ( testDelayMillis * 4 ) ) ;