Resolves test failures
This commit is contained in:
@ -39,13 +39,13 @@ public class GiantModelTest {
|
||||
*/
|
||||
@Test
|
||||
public void testSetHealth() {
|
||||
final var model = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.HUNGRY);
|
||||
final var model = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED);
|
||||
assertEquals(Health.HEALTHY, model.getHealth());
|
||||
var messageFormat = "The giant looks %s, alert and saturated.";
|
||||
for (final var health : Health.values()) {
|
||||
model.setHealth(health);
|
||||
assertEquals(health, model.getHealth());
|
||||
assertEquals("The giant looks " + health.toString() + ", alert and saturated.", model
|
||||
.toString());
|
||||
assertEquals(String.format(messageFormat, health), model.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,13 +54,13 @@ public class GiantModelTest {
|
||||
*/
|
||||
@Test
|
||||
public void testSetFatigue() {
|
||||
final var model = new GiantModel(Health.WOUNDED, Fatigue.ALERT, Nourishment.SATURATED);
|
||||
final var model = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED);
|
||||
assertEquals(Fatigue.ALERT, model.getFatigue());
|
||||
var messageFormat = "The giant looks healthy, %s and saturated.";
|
||||
for (final var fatigue : Fatigue.values()) {
|
||||
model.setFatigue(fatigue);
|
||||
assertEquals(fatigue, model.getFatigue());
|
||||
assertEquals("The giant looks healthy, " + fatigue.toString() + " and saturated.", model
|
||||
.toString());
|
||||
assertEquals(String.format(messageFormat, fatigue), model.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,13 +69,13 @@ public class GiantModelTest {
|
||||
*/
|
||||
@Test
|
||||
public void testSetNourishment() {
|
||||
final var model = new GiantModel(Health.HEALTHY, Fatigue.TIRED, Nourishment.SATURATED);
|
||||
final var model = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED);
|
||||
assertEquals(Nourishment.SATURATED, model.getNourishment());
|
||||
var messageFormat = "The giant looks healthy, alert and %s.";
|
||||
for (final var nourishment : Nourishment.values()) {
|
||||
model.setNourishment(nourishment);
|
||||
assertEquals(nourishment, model.getNourishment());
|
||||
assertEquals("The giant looks healthy, alert and " + nourishment.toString() + ".", model
|
||||
.toString());
|
||||
assertEquals(String.format(messageFormat, nourishment), model.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user