Skip to content

Commit

Permalink
Tests naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
louietyj committed Nov 6, 2016
1 parent 6105ae3 commit fe9082b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/test/java/seedu/todo/commons/EphemeralDBTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
public class EphemeralDBTest {

@Test
public void check_singleton() {
public void ephemeral_testSingleton_match() {
EphemeralDB one = EphemeralDB.getInstance();
EphemeralDB two = EphemeralDB.getInstance();
assertEquals(one, two);
}

@Test
public void test_calendar_items() {
public void ephemeral_testCalendarItems_found() {
CalendarItem task = new Task();
CalendarItem event = new Event();
EphemeralDB db = EphemeralDB.getInstance();
Expand All @@ -31,14 +31,14 @@ public void test_calendar_items() {
}

@Test
public void test_missing_calendar_item() {
public void ephemeral_missingCalendarItem_notFound() {
EphemeralDB db = EphemeralDB.getInstance();
assertEquals(db.getCalendarItemsByDisplayedId(0), null);
assertEquals(db.getCalendarItemsByDisplayedId(3), null);
}

@Test
public void test_clear_calendar_items() {
public void ephemeral_clearCalendarItems_notFound() {
CalendarItem task = new Task();
CalendarItem event = new Event();
EphemeralDB db = EphemeralDB.getInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,29 @@ private static Map<String, String[]> getTokenDefinitions() {
}

@Test
public void tokenizer_no_matches() throws Exception {
public void tokenizer_noMatch_notFound() throws Exception {
String input = "abcdefg hijklmnop";
Map<String, String[]> output = Tokenizer.tokenize(getTokenDefinitions(), input);
assertTrue(output.isEmpty());
}

@Test
public void tokenizer_empty_string() throws Exception {
public void tokenizer_emptyString_notFound() throws Exception {
String input = "";
Map<String, String[]> output = Tokenizer.tokenize(getTokenDefinitions(), input);
assertTrue(output == null);
}

@Test
public void tokenizer_single_match() throws Exception {
public void tokenizer_singleMatch_found() throws Exception {
String input = "token11 answer";
Map<String, String[]> output = Tokenizer.tokenize(getTokenDefinitions(), input);
assertEquals(output.get("tokenType1")[0], "token11");
assertEquals(output.get("tokenType1")[1], "answer");
}

@Test
public void tokenizer_empty_match() throws Exception {
public void tokenizer_emptyMatch_found() throws Exception {
String input = "alamak token11 token21";
Map<String, String[]> output = Tokenizer.tokenize(getTokenDefinitions(), input);
assertEquals(output.get("tokenType1")[0], "token11");
Expand All @@ -55,14 +55,14 @@ public void tokenizer_empty_match() throws Exception {
}

@Test
public void tokenizer_match_quotes() throws Exception {
public void tokenizer_matchQuotes_found() throws Exception {
String input = "\"token11\" answer";
Map<String, String[]> output = Tokenizer.tokenize(getTokenDefinitions(), input);
assertTrue(output.isEmpty());
}

@Test(expected=UnmatchedQuotesException.class)
public void tokenizer_unmatched_quotes() throws Exception {
public void tokenizer_unmatchedQuotes_error() throws Exception {
String input = "\"\"\"";
Tokenizer.tokenize(getTokenDefinitions(), input);
}
Expand Down
16 changes: 8 additions & 8 deletions src/test/java/seedu/todo/guitests/UndoRedoCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void resetDB() {
}

@Test
public void undo_single() {
public void undo_single_success() {
console.runCommand(commandAdd1);
assertTaskVisible(task1);
console.runCommand(commandAdd2);
Expand All @@ -53,7 +53,7 @@ public void undo_single() {
}

@Test
public void undo_multiple() {
public void undo_multiple_success() {
console.runCommand(commandAdd1);
assertTaskVisible(task1);
console.runCommand(commandAdd2);
Expand All @@ -64,7 +64,7 @@ public void undo_multiple() {
}

@Test
public void undo_notavailable() {
public void undo_notAvailable_fail() {
console.runCommand(commandAdd1);
assertTaskVisible(task1);
console.runCommand("undo");
Expand All @@ -76,13 +76,13 @@ public void undo_notavailable() {
}

@Test
public void undo_multiple_notavailable() {
public void undo_multipleNotAvailable_fail() {
console.runCommand("undo 3");
assertEquals(console.getConsoleTextArea(), "We cannot undo 3 commands! At most, you can undo 2 commands.");
}

@Test
public void redo_single() {
public void redo_single_success() {
console.runCommand(commandAdd1);
assertTaskVisible(task1);
console.runCommand("undo");
Expand All @@ -92,7 +92,7 @@ public void redo_single() {
}

@Test
public void redo_multiple() {
public void redo_multiple_success() {
console.runCommand(commandAdd1);
assertTaskVisible(task1);
console.runCommand(commandAdd2);
Expand All @@ -106,13 +106,13 @@ public void redo_multiple() {
}

@Test
public void redo_notavailable() {
public void redo_notAvailable_fail() {
console.runCommand("redo");
assertEquals(console.getConsoleTextArea(), "There is no command to redo!");
}

@Test
public void redo_multiple_notavailable() {
public void redo_multipleNotavailable_fail() {
console.runCommand("undo");
console.runCommand("redo 2");
assertEquals(console.getConsoleTextArea(), "We cannot redo 2 commands! At most, you can redo 1 command.");
Expand Down

0 comments on commit fe9082b

Please sign in to comment.