use of org.eclipse.milo.opcua.sdk.server.events.OperatorContext in project milo by eclipse.
the class EqualsTest method testScalarWithImplicitConversion.
@Test
public void testScalarWithImplicitConversion() throws Exception {
OperatorContext context = mock(OperatorContext.class);
BaseEventTypeNode eventNode = mock(BaseEventTypeNode.class);
FilterOperand op0 = new LiteralOperand(new Variant(42));
FilterOperand op1 = new LiteralOperand(new Variant(42L));
when(context.resolve(op0, eventNode)).thenReturn(42);
when(context.resolve(op1, eventNode)).thenReturn(42L);
Boolean result = Operators.EQUALS.apply(context, eventNode, new FilterOperand[] { op0, op1 });
assertNotNull(result);
assertTrue(result);
}
use of org.eclipse.milo.opcua.sdk.server.events.OperatorContext in project milo by eclipse.
the class IsNullTest method testNullValue.
@Test
public void testNullValue() throws Exception {
OperatorContext context = mock(OperatorContext.class);
BaseEventTypeNode eventNode = mock(BaseEventTypeNode.class);
FilterOperand op0 = new LiteralOperand(new Variant(null));
when(context.resolve(op0, eventNode)).thenReturn(null);
Boolean result = Operators.IS_NULL.apply(context, eventNode, new FilterOperand[] { op0 });
assertNotNull(result);
assertTrue(result);
}
use of org.eclipse.milo.opcua.sdk.server.events.OperatorContext in project milo by eclipse.
the class IsNullTest method testNonNullValue.
@Test
public void testNonNullValue() throws Exception {
OperatorContext context = mock(OperatorContext.class);
BaseEventTypeNode eventNode = mock(BaseEventTypeNode.class);
FilterOperand op0 = new LiteralOperand(new Variant(42));
when(context.resolve(op0, eventNode)).thenReturn(42);
Boolean result = Operators.IS_NULL.apply(context, eventNode, new FilterOperand[] { op0 });
assertNotNull(result);
assertFalse(result);
}
Aggregations