Exemplo n.º 1
0
  /** 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));
  }
Exemplo n.º 2
0
  /** 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));
  }
Exemplo n.º 3
0
  /** 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));
  }