public int returnCode() { if (!hasReturned()) { throw new RuntimeException("Process hasn't returned yet"); } return returnCode.intValue(); }
public int returnCode() { if (!hasReturned()) { throw new RuntimeException("Process hasn't returned yet"); } return returnCode.intValue(); }
@Override public int returnCode() { if (!hasReturned()) { throw new RuntimeException("Process hasn't returned yet"); } return returnCode.intValue(); }
public void testShellThrowsIfNotYetReturned() { assertFalse(shell.hasReturned()); Exception expected = null; try { shell.returnCode(); } catch (Exception e) { expected = e; } assertNotNull("Should have throws", expected); }
public void testSetters() { shell.setRuntime(new RuntimeI.Default()); shell.setEnvironment(new String[0]); shell.setWorkingDir(new FileUtil().tmp()); shell.run(); assertTrue(shell.hasReturned()); assertEquals(1, shell.returnCode()); }
public void testShellReturnsWithReturnCode() { int returnCode = 7; setRuntime(returnCode); shell.run(); assertTrue(shell.hasReturned()); assertEquals(returnCode, shell.returnCode()); }
public void testShellReturnsWithReturnCode() { int returnCode = 7; setRuntime(returnCode); shell.run(); assertTrue(shell.hasReturned()); assertEquals(returnCode, shell.returnCode()); }
public void testShellThrowsIfNotYetReturned() { assertFalse(shell.hasReturned()); Exception expected = null; try { shell.returnCode(); } catch (Exception e) { expected = e; } assertNotNull("Should have throws", expected); }
public void testSetters() { shell.setRuntime(new RuntimeI.Default()); shell.setEnvironment(new String[0]); shell.setWorkingDir(new Files().testDir()); shell.run(); assertTrue(shell.hasReturned()); int rv = shell.returnCode(); // this is _not_ a prefect test. // With some JVMs we get '1', others we get '0' .... // however if the "java" command is missing we get 127 on most unix assertEquals("" + rv, true, rv == 1 || rv == 0); }