|
26 | 26 | import org.junit.After;
|
27 | 27 | import org.junit.Before;
|
28 | 28 | import org.junit.Test;
|
| 29 | + |
29 | 30 | import static org.junit.Assert.assertEquals;
|
30 | 31 |
|
| 32 | +/** |
| 33 | + * Date: 28/04/17 - 7:40 AM |
| 34 | + * |
| 35 | + * @author Stanislav Kapinus |
| 36 | + */ |
| 37 | + |
31 | 38 | public class AdvancedSorceressTest {
|
32 | 39 |
|
33 |
| - private InMemoryAppender appender; |
| 40 | + private InMemoryAppender appender; |
34 | 41 |
|
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 | + } |
39 | 46 |
|
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 | + } |
52 | 51 |
|
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 { |
56 | 58 |
|
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 | + }; |
63 | 62 |
|
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()); |
65 | 69 |
|
66 |
| - // ... and nothing else is happening. |
67 |
| - assertEquals(tobaccos.length, appender.getLogSize()); |
68 | 70 | }
|
| 71 | + |
| 72 | + // ... and nothing else is happening. |
| 73 | + assertEquals(tobaccos.length, appender.getLogSize()); |
| 74 | + |
| 75 | + } |
69 | 76 | }
|
0 commit comments