- 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
|
||||
LOGGER.info("A troll with huge club surprises you.");
|
||||
troll = new ClubbedTroll(troll);
|
||||
troll.attack();
|
||||
troll.fleeBattle();
|
||||
LOGGER.info("Clubbed troll power {}.\n", troll.getAttackPower());
|
||||
Troll clubbedTroll = new ClubbedTroll(troll);
|
||||
clubbedTroll.attack();
|
||||
clubbedTroll.fleeBattle();
|
||||
LOGGER.info("Clubbed troll power {}.\n", clubbedTroll.getAttackPower());
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import static org.mockito.internal.verification.VerificationModeFactory.times;
|
||||
public class ClubbedTrollTest {
|
||||
|
||||
@Test
|
||||
public void testClubbedTroll() throws Exception {
|
||||
public void testClubbedTroll() {
|
||||
// Create a normal troll first, but make sure we can spy on it later on.
|
||||
final Troll simpleTroll = spy(new SimpleTroll());
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class SimpleTrollTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTrollActions() throws Exception {
|
||||
public void testTrollActions() {
|
||||
final SimpleTroll troll = new SimpleTroll();
|
||||
assertEquals(10, troll.getAttackPower());
|
||||
|
||||
|
Reference in New Issue
Block a user