Skip to content

Commit

Permalink
handle exception due to no platform support in CI test
Browse files Browse the repository at this point in the history
  • Loading branch information
bobjacobsen committed Dec 30, 2018
1 parent 7beabaa commit 3733969
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions java/test/jmri/jmrix/jinput/TreeModelTest.java
Expand Up @@ -23,7 +23,17 @@ public class TreeModelTest {
@Test
public void testInstance() throws InterruptedException {
Assume.assumeFalse(GraphicsEnvironment.isHeadless());
Assert.assertNotNull("exists", TreeModel.instance());
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();
}
Expand All @@ -34,5 +44,9 @@ public void setUp() {
}

@After
public void tearDown() { JUnitUtil.tearDown(); }
public void tearDown() {
JUnitUtil.tearDown();
}

private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(TreeModelTest.class);
}

0 comments on commit 3733969

Please sign in to comment.