use of org.apache.metron.stellar.common.shell.StellarResult in project metron by apache.
the class AssignmentCommandTest method testBadAssignmentExpr.
@Test
public void testBadAssignmentExpr() {
StellarResult result = command.execute("x := 2 + ", executor);
// validate the result
assertTrue(result.isError());
assertTrue(result.getException().isPresent());
// no assignment should have happened
assertFalse(executor.getState().containsKey("x"));
}
use of org.apache.metron.stellar.common.shell.StellarResult in project metron by apache.
the class AssignmentCommandTest method testAssignment.
@Test
public void testAssignment() {
StellarResult result = command.execute("x := 2 + 2", executor);
// validate the result
assertTrue(result.isSuccess());
assertTrue(result.getValue().isPresent());
assertEquals(4, result.getValue().get());
// validate assignment
assertEquals(4, executor.getState().get("x").getResult());
}
use of org.apache.metron.stellar.common.shell.StellarResult in project metron by apache.
the class AssignmentCommandTest method testAssignmentWithOddWhitespace.
@Test
public void testAssignmentWithOddWhitespace() {
StellarResult result = command.execute(" x := 2 + 2", executor);
// validate the result
assertTrue(result.isSuccess());
assertTrue(result.getValue().isPresent());
assertEquals(4, result.getValue().get());
// validate assignment
assertEquals(4, executor.getState().get("x").getResult());
}
use of org.apache.metron.stellar.common.shell.StellarResult in project metron by apache.
the class DocCommandTest method testFunctionNotDefined.
@Test
public void testFunctionNotDefined() {
StellarResult result = command.execute("?INVALID", executor);
// validate the result
assertTrue(result.isError());
assertTrue(result.getException().isPresent());
}
use of org.apache.metron.stellar.common.shell.StellarResult in project metron by apache.
the class DocCommandTest method testWithFunction.
@Test
public void testWithFunction() {
StellarResult result = command.execute("?TO_STRING", executor);
// validate the result
assertTrue(result.isSuccess());
assertTrue(result.getValue().isPresent());
// validate that we have some sort of doc string
assertTrue(result.getValue().toString().length() > 0);
}
Aggregations