Skip to content

Commit 17039dc

Browse files
authored
Update AdvancedSorceressTest.java
1 parent 30dcbee commit 17039dc

File tree

1 file changed

+36
-29
lines changed

1 file changed

+36
-29
lines changed

dependency-injection/src/test/java/com/iluwatar/dependency/injection/AdvancedSorceressTest.java

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,44 +26,51 @@
2626
import org.junit.After;
2727
import org.junit.Before;
2828
import org.junit.Test;
29+
2930
import static org.junit.Assert.assertEquals;
3031

32+
/**
33+
* Date: 28/04/17 - 7:40 AM
34+
*
35+
* @author Stanislav Kapinus
36+
*/
37+
3138
public class AdvancedSorceressTest {
3239

33-
private InMemoryAppender appender;
40+
private InMemoryAppender appender;
3441

35-
@Before
36-
public void setUp() {
37-
appender = new InMemoryAppender(Tobacco.class);
38-
}
42+
@Before
43+
public void setUp() {
44+
appender = new InMemoryAppender(Tobacco.class);
45+
}
3946

40-
@After
41-
public void tearDown() {
42-
appender.stop();
43-
}
44-
45-
/**
46-
* Test if the {@link AdvancedSorceress} smokes whatever instance of {@link Tobacco} is passed to her
47-
* through the setter's parameter
48-
*/
49-
50-
@Test
51-
public void testSmokeEveryThing() throws Exception {
47+
@After
48+
public void tearDown() {
49+
appender.stop();
50+
}
5251

53-
final Tobacco[] tobaccos = {
54-
new OldTobyTobacco(), new RivendellTobacco(), new SecondBreakfastTobacco()
55-
};
52+
/**
53+
* Test if the {@link AdvancedSorceress} smokes whatever instance of {@link Tobacco} is passed to her
54+
* through the setter's parameter
55+
*/
56+
@Test
57+
public void testSmokeEveryThing() throws Exception {
5658

57-
for (final Tobacco tobacco : tobaccos) {
58-
final AdvancedSorceress advancedSorceress = new AdvancedSorceress();
59-
advancedSorceress.setTobacco(tobacco);
60-
advancedSorceress.smoke();
61-
// Verify if the sorceress is smoking the correct tobacco ...
62-
assertEquals("AdvancedSorceress smoking " + tobacco.getClass().getSimpleName(), appender.getLastMessage());
59+
final Tobacco[] tobaccos = {
60+
new OldTobyTobacco(), new RivendellTobacco(), new SecondBreakfastTobacco()
61+
};
6362

64-
}
63+
for (final Tobacco tobacco : tobaccos) {
64+
final AdvancedSorceress advancedSorceress = new AdvancedSorceress();
65+
advancedSorceress.setTobacco(tobacco);
66+
advancedSorceress.smoke();
67+
// Verify if the sorceress is smoking the correct tobacco ...
68+
assertEquals("AdvancedSorceress smoking " + tobacco.getClass().getSimpleName(), appender.getLastMessage());
6569

66-
// ... and nothing else is happening.
67-
assertEquals(tobaccos.length, appender.getLogSize());
6870
}
71+
72+
// ... and nothing else is happening.
73+
assertEquals(tobaccos.length, appender.getLogSize());
74+
75+
}
6976
}

0 commit comments

Comments
 (0)