Add: Added "toString" Method And Relevant Test In Building11.java And Building11Test.java.
This commit is contained in:
@@ -6,6 +6,7 @@ import it.polimi.ingsw.gc14.Model.Cards.TribeCards.CharacterType;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
|
||||
public class Building11 extends BuildingCard {
|
||||
|
||||
private CharacterType icon ;
|
||||
|
||||
/**
|
||||
@@ -14,6 +15,7 @@ public class Building11 extends BuildingCard {
|
||||
* @return the CharacterType associated with this building card effect.
|
||||
*/
|
||||
public CharacterType getIcon() {return icon;}
|
||||
|
||||
private int PrestigeMul;
|
||||
|
||||
/**
|
||||
@@ -65,4 +67,9 @@ public class Building11 extends BuildingCard {
|
||||
throw new IllegalArgumentException();
|
||||
player.addPrestige(player.getNType(getIcon()) * this.getPrestigeMul());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " Icon: " + this.icon.toString();
|
||||
}
|
||||
}
|
||||
+22
-1
@@ -3,7 +3,6 @@ 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.TribeCards.CharacterType;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Artist;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.Hunter;
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -109,4 +108,26 @@ class Building11Test {
|
||||
b4.applyEffect(p5);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("toString")
|
||||
void testToString(){
|
||||
Building11 b11 = new Building11(1,2,3, CharacterType.INVENTOR, 1);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: INVENTOR", b11.toString());
|
||||
|
||||
b11 = new Building11(1,2,3, CharacterType.BUILDER, 1);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: BUILDER", b11.toString());
|
||||
|
||||
b11 = new Building11(1,2,3, CharacterType.GATHERER, 1);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: GATHERER", b11.toString());
|
||||
|
||||
b11 = new Building11(1,2,3, CharacterType.ARTIST, 1);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: ARTIST", b11.toString());
|
||||
|
||||
b11 = new Building11(1,2,3, CharacterType.SHAMAN, 1);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: SHAMAN", b11.toString());
|
||||
|
||||
b11 = new Building11(1,2,3, CharacterType.HUNTER, 1);
|
||||
assertEquals("Era:1 Price:2 Prestige:3 Icon: HUNTER", b11.toString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user