Skip to content

Commit

Permalink
Merge pull request nus-cs2113-AY2324S1#6 from wendelinwemhoener/add-j…
Browse files Browse the repository at this point in the history
…unit-tests

Add JUnit tests for flashcards
  • Loading branch information
junhyeong0411 committed Oct 13, 2023
2 parents 314f377 + 2af223b commit 79d78c7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/main/java/seedu/duke/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.util.Scanner;

/**
Expand Down
24 changes: 24 additions & 0 deletions src/test/java/seedu/duke/DukeTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
package seedu.duke;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;

import org.junit.jupiter.api.Test;
import seedu.duke.flashcard.FlashcardComponent;

import java.util.ArrayList;

class DukeTest {
@Test
public void sampleTest() {
assertTrue(true);
}

@Test
public void testFlashcardComponent_isResponsible_notResponsible() {
FlashcardComponent flashcardComponent = new FlashcardComponent(
new ArrayList<>());

assertFalse(flashcardComponent.isResponsible("dfdfdfdfdf"));
assertFalse(flashcardComponent.isResponsible("help me"));
assertFalse(flashcardComponent.isResponsible(" "));
}

@Test
public void testFlashcardComponent_isResponsible_responsible() {
FlashcardComponent flashcardComponent = new FlashcardComponent(
new ArrayList<>());

assertTrue(flashcardComponent.isResponsible("create flashcard"));
assertTrue(flashcardComponent.isResponsible("create flashcard "));
assertTrue(flashcardComponent.isResponsible("list flashcards"));
}
}
10 changes: 1 addition & 9 deletions text-ui-test/EXPECTED.TXT
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|

What is your name?
Hello James Gosling
Enter the front page text:
2 changes: 1 addition & 1 deletion text-ui-test/input.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
James Gosling
create flashcard

0 comments on commit 79d78c7

Please sign in to comment.