Repository navigation
Expand file tree
/
Copy pathJUnit4Test.java
More file actions
82 lines (66 loc) · 1.62 KB
/
Copy pathJUnit4Test.java
File metadata and controls
82 lines (66 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import java.util.logging.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExternalResource;
import misc.MiscUtils;
public class JUnit4Test {
private static final Logger log = Logger.getLogger(JUnit4Test.class.getSimpleName());
public JUnit4Test() {
log.info(MiscUtils.invocationInfo());
}
@Before
public void before() {
log.info(MiscUtils.invocationInfo());
}
@After
public void after() {
log.info(MiscUtils.invocationInfo());
}
@Rule
public ExternalResource res = new ExternalResource() {
Logger log = Logger.getLogger(ExternalResource.class.getSimpleName());
protected void before() throws Throwable {
this.log.info(MiscUtils.invocationInfo());
}
protected void after() {
this.log.info(MiscUtils.invocationInfo());
}
};
@BeforeClass
public static void beforeClass() {
log.info(MiscUtils.invocationInfo());
}
@AfterClass
public static void AfterClass() {
log.info(MiscUtils.invocationInfo());
}
@Test
public void testMd1() {
log.info(MiscUtils.invocationInfo());
Assert.assertTrue(false);
}
@Test
public void testMd2() {
log.info(MiscUtils.invocationInfo());
}
@Test(expected=IndexOutOfBoundsException.class)
public void testException() throws Exception {
int[] ia = new int[0];
ia[1] = 0;
}
@Test(timeout = 3000)
public void testTimeout() throws Exception {
Thread.sleep(4000);
}
@Ignore
@Test
public void testIgnore() {
log.info("you don't need to commment me out");
}
}