1 package it.com.example;
2
3 import com.atlassian.plugin.PluginAccessor;
4 import com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner;
5 import org.junit.Ignore;
6 import org.junit.Test;
7 import org.junit.runner.RunWith;
8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory;
10
11 import static java.lang.Boolean.getBoolean;
12 import static org.junit.Assert.assertNotNull;
13 import static org.junit.Assert.fail;
14
15
16
17
18 @RunWith(AtlassianPluginsTestRunner.class)
19 public class MyPluginTest
20 {
21 private static final String FAIL_ON_PURPOSE = MyPluginTest.class.getName() + ".fail";
22
23 private static final Logger LOGGER = LoggerFactory.getLogger(MyPluginTest.class);
24
25 private final PluginAccessor pluginAccessor;
26
27 public MyPluginTest(PluginAccessor pluginAccessor)
28 {
29 this.pluginAccessor = pluginAccessor;
30 }
31
32 @Test
33 public void testSomething()
34 {
35 LOGGER.info("I RAN!!!!!!!!!!!!!");
36 assert true;
37 }
38
39 @Test
40 public void testSomeFailure()
41 {
42 if (getBoolean(FAIL_ON_PURPOSE)) {
43 LOGGER.info("I RAN but failed...");
44 fail("Deliberate test failure to exercise the test console");
45 }
46 }
47
48 @Test
49 public void testPluginAccessor()
50 {
51 assertNotNull(pluginAccessor);
52 LOGGER.info("pluginAccessor = {}", pluginAccessor);
53 }
54
55 @Ignore
56 @Test
57 public void ignoredTest()
58 {
59 fail("Should never be run");
60 }
61 }