monster #20
@@ -217,6 +217,46 @@ public class MonsterTest {
|
||||
assertThat(defaultTroll.moveTo(destination, world), equalTo(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void get_health_returns_correct_value() {
|
||||
defaultShade = new Shade(8, Shade.MAX_ENERGY, Shade.DEFAULT_POSITION);
|
||||
assertThat(defaultShade.getHealth(), equalTo(8));
|
||||
}
|
||||
|
||||
@Test
|
||||
void get_energy_returns_correct_value() {
|
||||
defaultShade = new Shade(Shade.MAX_HEALTH, 10, Shade.DEFAULT_POSITION);
|
||||
assertThat(defaultShade.getEnergy(), equalTo(10));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shade_can_heal() {
|
||||
defaultShade = new Shade(8, Shade.MAX_ENERGY, Shade.DEFAULT_POSITION);
|
||||
assertThat(defaultShade.heal(), equalTo(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void troll_can_heal() {
|
||||
defaultTroll = new Troll(8, Troll.MAX_ENERGY, Troll.DEFAULT_POSITION);
|
||||
assertThat(defaultTroll.heal(), equalTo(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shade_can_take_damage() {
|
||||
assertThat(defaultShade.takeDamage(5), equalTo(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void troll_can_take_damage() {
|
||||
assertThat(defaultTroll.takeDamage(5), equalTo(true));
|
||||
}
|
||||
|
||||
@Test
|
||||
void troll_wont_heal_when_it_doesnt_have_enough_energy() {
|
||||
defaultTroll = new Troll(8, 2, Troll.DEFAULT_POSITION);
|
||||
assertThat(defaultTroll.heal(), equalTo(false));
|
||||
}
|
||||
|
||||
// HÄR BÖRJAR BESLUTSTABELLSTESTERNA
|
||||
|
||||
@Test
|
||||
@@ -256,25 +296,24 @@ public class MonsterTest {
|
||||
@Test
|
||||
void decision_table_t5() {
|
||||
when(mockTile.getBiome()).thenReturn(Biomes.COAST);
|
||||
Position destination = new Position(1, 3);
|
||||
|
||||
worldGenerator.randomWorldGeneration();
|
||||
World world = worldGenerator.getWorld();
|
||||
world.addTile(mockTile, destination);
|
||||
world.addTile(mockTile, defaultDestination);
|
||||
|
||||
assertThat(defaultTroll.moveTo(destination, world), equalTo(false));
|
||||
assertThat(defaultTroll.moveTo(defaultDestination, world), equalTo(false));
|
||||
}
|
||||
|
||||
@Test
|
||||
void decision_table_t6() {
|
||||
when(mockTile.getBiome()).thenReturn(Biomes.FOREST);
|
||||
Position destination = new Position(1, 3);
|
||||
when(mockPlayer.getPosition()).thenReturn(defaultDestination);
|
||||
|
||||
worldGenerator.randomWorldGeneration();
|
||||
World world = worldGenerator.getWorld();
|
||||
world.addTile(mockTile, destination);
|
||||
world.addTile(mockTile, defaultDestination);
|
||||
|
||||
assertThat(defaultTroll.moveTo(destination, world), equalTo(true));
|
||||
assertThat(defaultTroll.moveTo(defaultDestination, world), equalTo(true));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user