Skip to content

Commit 86e9c66

Browse files
author
hoangNam
committed
- Assign new clubberTroll instance to another variable.
- Remove redundant Exception from throws list in unit tests.
1 parent a6e6c22 commit 86e9c66

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

decorator/src/main/java/com/iluwatar/decorator/App.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public static void main(String[] args) {
5757

5858
// change the behavior of the simple troll by adding a decorator
5959
LOGGER.info("A troll with huge club surprises you.");
60-
troll = new ClubbedTroll(troll);
61-
troll.attack();
62-
troll.fleeBattle();
63-
LOGGER.info("Clubbed troll power {}.\n", troll.getAttackPower());
60+
Troll clubbedTroll = new ClubbedTroll(troll);
61+
clubbedTroll.attack();
62+
clubbedTroll.fleeBattle();
63+
LOGGER.info("Clubbed troll power {}.\n", clubbedTroll.getAttackPower());
6464
}
6565
}

decorator/src/test/java/com/iluwatar/decorator/ClubbedTrollTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
public class ClubbedTrollTest {
3737

3838
@Test
39-
public void testClubbedTroll() throws Exception {
39+
public void testClubbedTroll() {
4040
// Create a normal troll first, but make sure we can spy on it later on.
4141
final Troll simpleTroll = spy(new SimpleTroll());
4242

decorator/src/test/java/com/iluwatar/decorator/SimpleTrollTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public void tearDown() {
5353
}
5454

5555
@Test
56-
public void testTrollActions() throws Exception {
56+
public void testTrollActions() {
5757
final SimpleTroll troll = new SimpleTroll();
5858
assertEquals(10, troll.getAttackPower());
5959

0 commit comments

Comments
 (0)