Skip to content

Commit

Permalink
deck remove test1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali-Abbasi-Vadeghani committed Jun 26, 2021
1 parent 74fb32c commit a20de27
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/controller/DeckController.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void removeCard(String userInput) {
ApplicationManger.getLoggedInUser().getUserData().save();
}
} else {
if (Deck.isThereThisCardInMainDeckOfThisDeck(removeCardCommand.getField("card"), removeCardCommand.getField("deck"))) {
if (!Deck.isThereThisCardInMainDeckOfThisDeck(removeCardCommand.getField("card"), removeCardCommand.getField("deck"))) {
System.out.println("card with name " + removeCardCommand.getField("card") + " does not exist in main deck");
} else {
System.out.println("card removed form deck successfully");
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/model/Deck.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ public static boolean isThereThisCardInMainDeckOfThisDeck(String nameOfCard, Str
else return deck.mainDeck.contains(Card.getCardIdByName(nameOfCard));
}
catch (Exception e){
e.printStackTrace();
return false;
}
return false;
}

public static void removeCardFromDeck(String nameOfCard, String nameOfDeck, String mainOrSide) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/controller/DeckControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ void removeCard() throws ParseCommandException {
assertEquals(output, outputStreamCaptor.toString());
outputStreamCaptor.reset();
input = "--card Name --deck first";
output = "you bought Monster Reborn successfully." + System.lineSeparator() + "card added to deck successfully" + System.lineSeparator() + "card with name cardName does not exist in main deck" + System.lineSeparator();
output = "card with name Name does not exist in main deck" + System.lineSeparator();
deckController.removeCard(input);
assertEquals(output, outputStreamCaptor.toString());
outputStreamCaptor.reset();
input = "--card Monster Reborn --deck first";
output = "you bought Monster Reborn successfully." + System.lineSeparator() + "card added to deck successfully" + System.lineSeparator() + "card removed form deck successfully" + System.lineSeparator();
output = "card removed form deck successfully" + System.lineSeparator();
deckController.removeCard(input);
assertEquals(output, outputStreamCaptor.toString());

Expand Down

0 comments on commit a20de27

Please sign in to comment.