Buggy code:
public class StorageTest { @ Test public void testSaveConfiguration ( ) { } @ Test public void testWriteToFile ( ) { } @ Test public void testConvertTaskBetweenJsonString ( ) { } @ Test public void testSaveAndReadTaskList ( ) { try { Storage storage = new Storage ( ) ; Method save = Storage . class . getDeclaredMethod ( "saveTaskList" , String . class , TaskList . class ) ; save . setAccessible ( true ) ; Method read = Storage . class . getDeclaredMethod ( "readTaskStorage" , String . class ) ; read . setAccessible ( true ) ; String fileName = "testFile.txt" ; TaskList testList = new TaskList ( ) ; TaskList result ; Task saveTask ; Task readTask ; Task task1 = new Task ( "task1" , "description1" , new Date ( System . currentTimeMillis ( ) ) , 3 , "first<seq2seq4repair_space>tag" , 1 ) ; Task task2 = new Task ( "task2" , "description2" , new Date ( System . currentTimeMillis ( ) ) , 2 , "second<seq2seq4repair_space>tag" , 2 ) ; testList . add ( task1 ) ; testList . add ( task2 ) ; save . invoke ( storage , fileName , testList ) ; result = ( ( TaskList ) ( read . invoke ( storage , fileName ) ) ) ; for ( int i = 0 ; i < ( testList . size ( ) ) ; i ++ ) { saveTask = testList . get ( i ) ; readTask = result . get ( i ) ; assertEquals ( "name<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getName ( ) , readTask . getName ( ) ) ; assertEquals ( "description<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getDescription ( ) , readTask . getDescription ( ) ) ; assertEquals ( "tag<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getTag ( ) , readTask . getTag ( ) ) ; assertEquals ( "priority<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getPriority ( ) , readTask . getPriority ( ) ) ; assertEquals ( "due<seq2seq4repair_space>date<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getDueDate ( ) , readTask . getDueDate ( ) ) ; assertEquals ( "created<seq2seq4repair_space>date<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getCreatedDate ( ) , readTask . getCreatedDate ( ) ) ; assertEquals ( "done<seq2seq4repair_space>status<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . isDone ( ) , readTask . isDone ( ) ) ; assertEquals ( "floating<seq2seq4repair_space>status<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . isFloating ( ) , readTask . isFloating ( ) ) ; assertEquals ( "ID<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getID ( ) , readTask . getID ( ) ) ; } Task task3 = new Task ( "task3" , "description3" , new Date ( System . currentTimeMillis ( ) ) , 1 , "third<seq2seq4repair_space>tag" , 3 ) ; <START_BUG> Task task4 = new Task ( "task4" , "description4" , new Date ( System . currentTimeMillis ( ) ) , 8 , "fourth<seq2seq4repair_space>tag" , 4 ) ; <END_BUG> save . invoke ( storage , fileName , testList ) ; result = ( ( TaskList ) ( read . invoke ( storage , fileName ) ) ) ; for ( int i = 0 ; i < ( testList . size ( ) ) ; i ++ ) { saveTask = testList . get ( i ) ; readTask = result . get ( i ) ; assertEquals ( "name<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getName ( ) , readTask . getName ( ) ) ; assertEquals ( "description<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getDescription ( ) , readTask . getDescription ( ) ) ; assertEquals ( "tag<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getTag ( ) , readTask . getTag ( ) ) ; assertEquals ( "priority<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getPriority ( ) , readTask . getPriority ( ) ) ; assertEquals ( "due<seq2seq4repair_space>date<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getDueDate ( ) , readTask . getDueDate ( ) ) ; assertEquals ( "created<seq2seq4repair_space>date<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getCreatedDate ( ) , readTask . getCreatedDate ( ) ) ; assertEquals ( "done<seq2seq4repair_space>status<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . isDone ( ) , readTask . isDone ( ) ) ; assertEquals ( "floating<seq2seq4repair_space>status<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . isFloating ( ) , readTask . isFloating ( ) ) ; assertEquals ( "ID<seq2seq4repair_space>after<seq2seq4repair_space>converting<seq2seq4repair_space>back<seq2seq4repair_space>and<seq2seq4repair_space>forth<seq2seq4repair_space>should<seq2seq4repair_space>be<seq2seq4repair_space>equal" , saveTask . getID ( ) , readTask . getID ( ) ) ; } File configFile = new File ( fileName ) ; configFile . delete ( ) ; } catch ( Exception e ) { fail ( e . toString ( ) ) ; } } }

Fix:
Task task4 = new Task ( "task4" , "description4" , null , 8 , "fourth<seq2seq4repair_space>tag" , 4 ) ;