Add: Added "toString" Method And Relevant Test In Building1.java And Building1Test.java.
This commit is contained in:
@@ -2,11 +2,8 @@ package it.polimi.ingsw.gc14.Model.Cards.Building.Effects;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Cards.Building.EffectType;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Character;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* During the Sustenance Event, you have a discount of 1 food token on the total you
|
||||
@@ -47,4 +44,8 @@ public class Building1 extends BuildingCard {
|
||||
return new Building1(getEra(),getPrice(),getPrestigeValue(),getIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " Icon: " + this.icon.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,4 +66,26 @@ class Building1Test {
|
||||
assertEquals(Prestige, bClone.getPrestigeValue());
|
||||
assertEquals(ct, b0.getIcon());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("toString")
|
||||
void testToString(){
|
||||
Building1 b1 = new Building1(1,2,3, CharacterType.INVENTOR);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: INVENTOR", b1.toString());
|
||||
|
||||
b1 = new Building1(1,2,3, CharacterType.BUILDER);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: BUILDER", b1.toString());
|
||||
|
||||
b1 = new Building1(1,2,3, CharacterType.GATHERER);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: GATHERER", b1.toString());
|
||||
|
||||
b1 = new Building1(1,2,3, CharacterType.ARTIST);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: ARTIST", b1.toString());
|
||||
|
||||
b1 = new Building1(1,2,3, CharacterType.SHAMAN);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: SHAMAN", b1.toString());
|
||||
|
||||
b1 = new Building1(1,2,3, CharacterType.HUNTER);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: HUNTER", b1.toString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user