forked from nus-cs2113-AY2324S2/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nus-cs2113-AY2324S2#35 from samuelory/Samuel-V0.3
Added more JUnit Tests
- Loading branch information
Showing
4 changed files
with
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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.assertEquals; | ||
|
||
public class AddBouquetTest { | ||
@Test | ||
void testAddCommandExecute(){ | ||
Bouquet testBouquet = new Bouquet("for testing"); | ||
Ui ui = new Ui(); | ||
ArrayList<Bouquet> controlList = new ArrayList<>(); | ||
ArrayList<Bouquet> testList = new ArrayList<>(); | ||
controlList.add(testBouquet); | ||
Command testAddBouquetCommand = new AddBouquetCommand(testBouquet); | ||
try { | ||
testAddBouquetCommand.execute(testList, ui); | ||
} | ||
catch(FlorizzException error){ | ||
ui.printError(error); | ||
} | ||
assertEquals(controlList, testList); | ||
} | ||
} |
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,31 @@ | ||
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.assertEquals; | ||
|
||
public class DeleteBouquetTest { | ||
@Test | ||
void testAddCommandExecute(){ | ||
Bouquet testBouquet = new Bouquet("for testing"); | ||
Ui ui = new Ui(); | ||
ArrayList<Bouquet> controlList = new ArrayList<>(); | ||
ArrayList<Bouquet> testList = new ArrayList<>(); | ||
controlList.add(testBouquet); | ||
testList.add(testBouquet); | ||
Command testDeleteBouquetCommand = new DeleteBouquetCommand(testBouquet); | ||
controlList.remove(testBouquet); | ||
try { | ||
testDeleteBouquetCommand.execute(testList, ui); | ||
} | ||
catch(FlorizzException error){ | ||
ui.printError(error); | ||
} | ||
assertEquals(controlList, testList); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
src/test/java/florizz/objects/ExitTest.java → src/test/java/florizz/command/ExitTest.java
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
3 changes: 2 additions & 1 deletion
3
src/test/java/florizz/objects/HelpTest.java → src/test/java/florizz/command/HelpTest.java
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