@Test public void testChangeRole() throws Exception { Role startingRole = humanCharacter.getRole(); int startingHealth = humanCharacter.getHealth(); int startingDamage = humanCharacter.getDamage(); int startingSpeed = humanCharacter.getSpeed(); int startingFireRate = humanCharacter.getFireRate(); Role newRole = new Sniper(); humanCharacter.changeRole(newRole); assertNotEquals("the role has not changed", startingRole, humanCharacter.getRole()); assertEquals("the new role is not the one that was set", newRole, humanCharacter.getRole()); assertNotEquals( "the health has not changed after switching role", startingHealth, humanCharacter.getHealth()); assertNotEquals( "the damage has not changed after switching role", startingDamage, humanCharacter.getDamage()); assertNotEquals( "the speed has not changed after switching role", startingSpeed, humanCharacter.getSpeed()); assertNotEquals( "the fire-rate has not changed after switching role", startingFireRate, humanCharacter.getFireRate()); }
@Test public void testGetRole() throws Exception { assertEquals(role, humanCharacter.getRole()); }