code-coverage-Emilia #24

Merged
erns6604 merged 14 commits from code-coverage-Emilia into main 2025-10-31 16:29:43 +01:00
Showing only changes of commit 8d42a16b20 - Show all commits

View File

@ -16,8 +16,14 @@ public class EquipmentTest {
private Player defaultWizard(){
return new Player("name", wizard);
}
private AttributeModifier defaultAttributeModifier(){
return new AttributeModifier(4,8,7,1,2,8);
}
private BodyArmour defaultArmorType(){
return new BodyArmour("Body Armour", defaultAttributeModifier());
}
private Equipment defaultBodyArmour() {
AttributeModifier a = new AttributeModifier(4,8,7,1,2,8);
AttributeModifier a = defaultAttributeModifier();
BodyArmour b = new BodyArmour("Body Armour", a);
return new Equipment("5", "Thornmail", b, knight, 2);
}
@ -129,6 +135,13 @@ public class EquipmentTest {
assertTrue(p.getEquipments().get(defaultMageHat().getSlot()).equals(defaultMageHat()), "Wizard can equip wizard hat");
}
@Test
void isNotEqualIfNameIsDifferent() {
var e1 = new Equipment("e1", "equipment 1", defaultArmorType(), knight, 1);
var e2 = new Equipment("e2", "equipment 2", defaultArmorType(), knight, 1);
assertFalse(e1.equals(e2));
}
@Test
void canNotEquipWithWrongJob() {
var p = defaultWizard();