forked from nus-cs2113-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d204876
commit 208a704
Showing
2 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package florizz.command; | ||
|
||
import florizz.core.FlorizzException; | ||
import florizz.core.Ui; | ||
import florizz.objects.Bouquet; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.ArrayList; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class CompareCommandTest { | ||
|
||
@Test | ||
void testCompareExecute() { // Comparing two different flowers | ||
CompareCommand testCompareCommand = new CompareCommand("Rose", "Lily"); | ||
ArrayList<Bouquet> testList = new ArrayList<>(); | ||
Ui ui = new Ui(); | ||
try { | ||
assertTrue(testCompareCommand.execute(testList, ui)); | ||
} catch (FlorizzException error) { | ||
ui.printError(error); | ||
} | ||
} | ||
|
||
@Test | ||
void testCompareException1() { // Comparing the same flower | ||
ArrayList<Bouquet> testList = new ArrayList<>(); | ||
Ui ui = new Ui(); | ||
CompareCommand testCompareCommand2 = new CompareCommand("Rose", "Rose"); | ||
assertThrows(FlorizzException.class, () -> testCompareCommand2.execute(testList, ui)); | ||
} | ||
|
||
@Test | ||
void testCompareException2() { // Comparing a flower that does not exist | ||
ArrayList<Bouquet> testList = new ArrayList<>(); | ||
Ui ui = new Ui(); | ||
CompareCommand testCompareCommand3 = new CompareCommand("Rose", "Tulip"); | ||
assertThrows(FlorizzException.class, () -> testCompareCommand3.execute(testList, ui)); | ||
} | ||
} |