/
TreeModelTest.java
52 lines (45 loc) · 1.42 KB
/
TreeModelTest.java
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
package jmri.jmrix.jinput;
import java.awt.GraphicsEnvironment;
import jmri.util.JUnitUtil;
import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.junit.Rule;
import org.junit.rules.Timeout;
/**
* Test simple functioning of TreeModel
*
* @author Paul Bender Copyright (C) 2016
*/
public class TreeModelTest {
@Rule
public Timeout globalTimeout = Timeout.seconds(10); // 10 second timeout for methods in this test class.
@Test
public void testInstance() throws InterruptedException {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
try {
Assert.assertNotNull("exists", TreeModel.instance());
} catch (Throwable e) {
if (e instanceof ClassNotFoundException) {
log.info("TreeModel.instance threw ClassNotFoundException, which means we can't test on this platform");
return;
} else {
log.error("instance threw", e);
Assert.fail("instance threw "+e);
}
}
// then kill the thread
TreeModel.instance().terminateThreads();
}
@Before
public void setUp() {
JUnitUtil.setUp();
}
@After
public void tearDown() {
JUnitUtil.tearDown();
}
private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(TreeModelTest.class);
}