Skip to content

Commit

Permalink
Test Storage
Browse files Browse the repository at this point in the history
  • Loading branch information
junhyeong0411 committed Oct 18, 2023
1 parent a74ef39 commit 64869bd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/seedu/duke/flashcard/FlashcardComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public FlashcardComponent(ArrayList<Flashcard> flashcards) {
ui = new FlashcardUi(flashcardList);
}

//@@author junhyeong0411
public FlashcardStorage getStorage(){
return this.storage;
}

//@@author wendelinwemhoener
public boolean isResponsible(String input) {
FlashcardCommand command = parser.parseInput(input);

Expand Down
7 changes: 7 additions & 0 deletions src/main/java/seedu/duke/flashcard/FlashcardStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public FlashcardStorage(String path){
}


public boolean isStorageAvailable(){
File f = new File(this.path);
return f.exists();
}

/**
* load a flash card from certain format
* Tokens includes attributes of Flashcard
Expand Down Expand Up @@ -99,4 +104,6 @@ public void saveFlashcards(ArrayList<Flashcard> flashcardList) {





}
9 changes: 9 additions & 0 deletions src/test/java/seedu/duke/DukeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

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

import java.util.ArrayList;

Expand Down Expand Up @@ -34,6 +35,14 @@ public void testFlashcardComponent_isResponsible_responsible() {
assertTrue(flashcardComponent.isResponsible("list flashcards"));
}

@Test
public void testFlashcardStorage_isAvailable(){
FlashcardComponent flashcardComponent = new FlashcardComponent(
new ArrayList<>());
FlashcardStorage storage = flashcardComponent.getStorage();
assertTrue(storage.isStorageAvailable());
}

@Test
public void testCalendar() {
assertTrue(true);
Expand Down

0 comments on commit 64869bd

Please sign in to comment.