use of de.prob.prolog.term.CompoundPrologTerm in project prob2 by bendisposto.
the class GetStateBasedErrorsCommandTest method testErrorProcessResult1.
@Test(expected = ResultParserException.class)
public void testErrorProcessResult1() {
@SuppressWarnings("unchecked") ISimplifiedROMap<String, PrologTerm> map = mock(ISimplifiedROMap.class);
when(map.get("Errors")).thenReturn(new ListPrologTerm(new CompoundPrologTerm("foobar")));
GetStateBasedErrorsCommand command = new GetStateBasedErrorsCommand("state");
command.processResult(map);
}
use of de.prob.prolog.term.CompoundPrologTerm in project prob2 by bendisposto.
the class GetErrorsCommandTest method testProcessResults.
@Test
public void testProcessResults() {
@SuppressWarnings("unchecked") ISimplifiedROMap<String, PrologTerm> map = mock(ISimplifiedROMap.class);
when(map.get(anyString())).thenReturn(new ListPrologTerm(new CompoundPrologTerm("foobar")));
GetErrorsCommand command = new GetErrorsCommand();
command.processResult(map);
List<String> errors = command.getErrors();
assertEquals("foobar", errors.get(0));
}
use of de.prob.prolog.term.CompoundPrologTerm in project prob2 by bendisposto.
the class GetPreferencesCommandTest method testProcessResultsFail.
@Test(expected = ResultParserException.class)
public void testProcessResultsFail() {
@SuppressWarnings("unchecked") ISimplifiedROMap<String, PrologTerm> map = mock(ISimplifiedROMap.class);
when(map.get(anyString())).thenReturn(new ListPrologTerm(new CompoundPrologTerm("blah blah blah")));
GetDefaultPreferencesCommand command = new GetDefaultPreferencesCommand();
command.processResult(map);
}
use of de.prob.prolog.term.CompoundPrologTerm in project prob2 by bendisposto.
the class GetPreferencesCommandTest method testProcessResultsFail2.
@Test(expected = ResultParserException.class)
public void testProcessResultsFail2() {
@SuppressWarnings("unchecked") ISimplifiedROMap<String, PrologTerm> map = mock(ISimplifiedROMap.class);
when(map.get(anyString())).thenReturn(new CompoundPrologTerm("blah blah blah"));
GetDefaultPreferencesCommand command = new GetDefaultPreferencesCommand();
command.processResult(map);
}
use of de.prob.prolog.term.CompoundPrologTerm in project prob2 by bendisposto.
the class GetOperationsWithTimeoutTest method testWriteCommand.
@Test
public void testWriteCommand() {
StructuredPrologOutput prologTermOutput = new StructuredPrologOutput();
GetOperationsWithTimeout command = new GetOperationsWithTimeout("state");
command.writeCommand(prologTermOutput);
prologTermOutput.fullstop().flush();
Collection<PrologTerm> sentences = prologTermOutput.getSentences();
PrologTerm next = sentences.iterator().next();
assertNotNull(next);
assertTrue(next instanceof CompoundPrologTerm);
CompoundPrologTerm t = (CompoundPrologTerm) next;
assertEquals("op_timeout_occurred", t.getFunctor());
assertEquals(2, t.getArity());
PrologTerm argument = t.getArgument(1);
assertTrue(argument.isAtom());
PrologTerm argument2 = t.getArgument(2);
assertTrue(argument2.isVariable());
}
Aggregations