Skip to content

Commit 79d78c7

Browse files
Merge pull request nus-cs2113-AY2324S1#6 from wendelinwemhoener/add-junit-tests
Add JUnit tests for flashcards
2 parents 314f377 + 2af223b commit 79d78c7

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

src/main/java/seedu/duke/Storage.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.io.File;
44
import java.io.FileNotFoundException;
5-
import java.io.FileWriter;
65
import java.util.Scanner;
76

87
/**
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,36 @@
11
package seedu.duke;
22

33
import static org.junit.jupiter.api.Assertions.assertTrue;
4+
import static org.junit.jupiter.api.Assertions.assertFalse;
45

56
import org.junit.jupiter.api.Test;
7+
import seedu.duke.flashcard.FlashcardComponent;
8+
9+
import java.util.ArrayList;
610

711
class DukeTest {
812
@Test
913
public void sampleTest() {
1014
assertTrue(true);
1115
}
16+
17+
@Test
18+
public void testFlashcardComponent_isResponsible_notResponsible() {
19+
FlashcardComponent flashcardComponent = new FlashcardComponent(
20+
new ArrayList<>());
21+
22+
assertFalse(flashcardComponent.isResponsible("dfdfdfdfdf"));
23+
assertFalse(flashcardComponent.isResponsible("help me"));
24+
assertFalse(flashcardComponent.isResponsible(" "));
25+
}
26+
27+
@Test
28+
public void testFlashcardComponent_isResponsible_responsible() {
29+
FlashcardComponent flashcardComponent = new FlashcardComponent(
30+
new ArrayList<>());
31+
32+
assertTrue(flashcardComponent.isResponsible("create flashcard"));
33+
assertTrue(flashcardComponent.isResponsible("create flashcard "));
34+
assertTrue(flashcardComponent.isResponsible("list flashcards"));
35+
}
1236
}

text-ui-test/EXPECTED.TXT

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
1-
Hello from
2-
____ _
3-
| _ \ _ _| | _____
4-
| | | | | | | |/ / _ \
5-
| |_| | |_| | < __/
6-
|____/ \__,_|_|\_\___|
7-
8-
What is your name?
9-
Hello James Gosling
1+
Enter the front page text:

text-ui-test/input.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
James Gosling
1+
create flashcard

0 commit comments

Comments
 (0)