- Assign new clubberTroll instance to another variable.
- Remove redundant Exception from throws list in unit tests.
This commit is contained in:
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
|
|
||||||
|
@ -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());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user