public void testForThrownExceptions() throws Exception { shell = new Shell.Default(null, "foo", null, null); Exception expected = null; try { shell.run(); } catch (Exception e) { expected = e; } assertNotNull(expected); }
public void testForThrownExceptions() throws Exception { shell = new Shell.Default(null, "foo", null, null); Exception expected = null; try { shell.run(); } catch (Exception e) { expected = e; } assertNotNull(expected); }
public void testShellThrowsIfNotYetReturned() { assertFalse(shell.hasReturned()); Exception expected = null; try { shell.returnCode(); } catch (Exception e) { expected = e; } assertNotNull("Should have throws", expected); }
public void testShellThrowsIfNotYetReturned() { assertFalse(shell.hasReturned()); Exception expected = null; try { shell.returnCode(); } catch (Exception e) { expected = e; } assertNotNull("Should have throws", expected); }
public void testDoubleRun() { processSleep = 2000; shell.start(); new Threads().pause(20); Exception expected = null; try { shell.run(); } catch (IllegalStateException e) { expected = e; } assertNotNull(expected); }
public void testDoubleRun() { processSleep = 2000; shell.start(); new Threads().pause(20); Exception expected = null; try { shell.run(); } catch (IllegalStateException e) { expected = e; } assertNotNull(expected); }
public void testCompletionListener() { Exception expected = null; try { shell.addCompletionListener(null); } catch (IllegalArgumentException e) { expected = e; } assertNotNull(expected); class TestListener implements Runnable { int timesRun = 0; public void run() { timesRun++; } } TestListener listener = new TestListener(); shell.addCompletionListener(listener); shell.run(); for (int c = 0; c < 5 && (listener.timesRun == 0); c++) { new Threads().pause(10); } assertEquals(1, listener.timesRun); }
public void testCompletionListener() { Exception expected = null; try { shell.addCompletionListener(null); } catch (IllegalArgumentException e) { expected = e; } assertNotNull(expected); class TestListener implements Runnable { int timesRun = 0; public void run() { timesRun++; } } TestListener listener = new TestListener(); shell.addCompletionListener(listener); shell.run(); for (int c = 0; c < 5 && (listener.timesRun == 0); c++) { new Threads().pause(10); } assertEquals(1, listener.timesRun); }