IsNull implements Operator<Boolean> { @Nullable @Override public Boolean apply( OperatorContext context, BaseEventTypeNode eventNode, FilterOperand[] operands) throws UaException { validate(context, operands); Object value = context.resolve(operands[0], eventNode); return value == null; } IsNull(); @Override void validate(FilterContext context, FilterOperand[] operands); @Nullable @Override Boolean apply(
        OperatorContext context,
        BaseEventTypeNode eventNode,
        FilterOperand[] operands);  }
@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); }
@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); }