- Assign new clubberTroll instance to another variable.

- Remove redundant Exception from throws list in unit tests.
This commit is contained in:
hoangNam
2018-10-15 11:41:14 +07:00
parent a6e6c22bf6
commit 86e9c66ca5
3 changed files with 6 additions and 6 deletions

View File

@ -57,9 +57,9 @@ public class App {
// change the behavior of the simple troll by adding a decorator // change the behavior of the simple troll by adding a decorator
LOGGER.info("A troll with huge club surprises you."); LOGGER.info("A troll with huge club surprises you.");
troll = new ClubbedTroll(troll); Troll clubbedTroll = new ClubbedTroll(troll);
troll.attack(); clubbedTroll.attack();
troll.fleeBattle(); clubbedTroll.fleeBattle();
LOGGER.info("Clubbed troll power {}.\n", troll.getAttackPower()); LOGGER.info("Clubbed troll power {}.\n", clubbedTroll.getAttackPower());
} }
} }

View File

@ -36,7 +36,7 @@ import static org.mockito.internal.verification.VerificationModeFactory.times;
public class ClubbedTrollTest { public class ClubbedTrollTest {
@Test @Test
public void testClubbedTroll() throws Exception { public void testClubbedTroll() {
// Create a normal troll first, but make sure we can spy on it later on. // Create a normal troll first, but make sure we can spy on it later on.
final Troll simpleTroll = spy(new SimpleTroll()); final Troll simpleTroll = spy(new SimpleTroll());

View File

@ -53,7 +53,7 @@ public class SimpleTrollTest {
} }
@Test @Test
public void testTrollActions() throws Exception { public void testTrollActions() {
final SimpleTroll troll = new SimpleTroll(); final SimpleTroll troll = new SimpleTroll();
assertEquals(10, troll.getAttackPower()); assertEquals(10, troll.getAttackPower());