public void testCancel() {
try {
// test unrecognized option
{
String[] parameters = {"-v", "-l"};
CliFrontend testFrontend = new CliFrontend();
int retCode = testFrontend.cancel(parameters);
assertTrue(retCode == 2);
}
// test missing job id
{
String[] parameters = {};
CliFrontend testFrontend = new CliFrontend();
int retCode = testFrontend.cancel(parameters);
assertTrue(retCode != 0);
}
// test cancel properly
{
JobID jid = new JobID();
String jidString = jid.toString();
String[] parameters = {"-i", jidString};
InfoListTestCliFrontend testFrontend = new InfoListTestCliFrontend(new TestProtocol(jid));
int retCode = testFrontend.cancel(parameters);
assertTrue(retCode == 0);
}
}
catch (Exception e) {
System.err.println(e.getMessage());