Skip to content

Instantly share code, notes, and snippets.

@tfnico
Created December 5, 2011 13:53
Show Gist options
  • Save tfnico/1433647 to your computer and use it in GitHub Desktop.
Save tfnico/1433647 to your computer and use it in GitHub Desktop.
Splitting tests
@Test(expected=NullPointerException.class)
public void psmThrowsNullPointerExceptionWhenCopying() {
Aristo a = new Aristo();
Runtime r = mock(Runtime.class);
a.setRuntime(r);
a.PSMCopy("oldPSM", "newPSM");
}
@Test(expected=IOException.class)
public void psmThrowsIOExceptionWhenExecuting() {
Aristo a = new Aristo();
Runtime r = mock(Runtime.class);
a.setRuntime(r);
a.PSMCopy("oldPSM", "newPSM");
verify(r).exec("PSMcopy oldPSM newPSM");
}
@jraregris
Copy link

private void run(String command) throws IOException {
BufferedReader r = (new BufferedReader(new InputStreamReader(runtime.
exec(command).
getInputStream())));
String l = new String();
while ((l = r.readLine()) != null) {
out.append(l);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment