/** Test if the "Sort" works in TextBuddy.java */ @Test public void testSortList() { TextBuddy textBuddy = new TextBuddy("unsortedList.txt"); String fileName = textBuddy.getFileName(); TextBuddy.sort(fileName); ArrayList<String> unsortedList = TextBuddy.readFile(fileName); ArrayList<String> sortedList = TextBuddy.readFile("sortedList.txt"); assertEquals(true, isCompareList(unsortedList, sortedList)); }
/** Test if the "Display" works in TextBuddy.java */ @Test public void testDisplay() { TextBuddy textBuddy = new TextBuddy("display.txt"); String fileName = textBuddy.getFileName(); ArrayList<String> originalDisplayList = TextBuddy.readFile("display.txt"); ArrayList<String> displayList = TextBuddy.display(fileName); assertEquals(true, isCompareList(displayList, originalDisplayList)); }
/** Test if the "Search" works in TextBuddy.java */ @Test public void testSearchKeywords() { TextBuddy textBuddy = new TextBuddy("searchList.txt"); String fileName = textBuddy.getFileName(); String keyword = "name"; ArrayList<String> searchList = TextBuddy.search(keyword, fileName); ArrayList<String> searchResultList = TextBuddy.readFile("searchResultList.txt"); assertEquals(true, isCompareList(searchList, searchResultList)); }