@Test
  public void comparingUndefinedValuesShouldReturnBooleanOrUndefined()
      throws TypeMismatchException {
    assertThat(TypeUtils.compare(QueryService.UNDEFINED, new Object(), OQLLexerTokenTypes.TOK_NE))
        .isNotNull().isEqualTo(Boolean.TRUE);
    assertThat(TypeUtils.compare(new Object(), QueryService.UNDEFINED, OQLLexerTokenTypes.TOK_NE))
        .isNotNull().isEqualTo(Boolean.TRUE);
    assertThat(TypeUtils.compare(QueryService.UNDEFINED, QueryService.UNDEFINED,
        OQLLexerTokenTypes.TOK_EQ)).isNotNull().isEqualTo(Boolean.TRUE);

    assertThat(TypeUtils.compare(QueryService.UNDEFINED, new Object(), OQLLexerTokenTypes.TOK_EQ))
        .isNotNull().isEqualTo(QueryService.UNDEFINED);
    assertThat(TypeUtils.compare(new Object(), QueryService.UNDEFINED, OQLLexerTokenTypes.TOK_EQ))
        .isNotNull().isEqualTo(QueryService.UNDEFINED);
    assertThat(TypeUtils.compare(QueryService.UNDEFINED, QueryService.UNDEFINED,
        OQLLexerTokenTypes.TOK_NE)).isNotNull().isEqualTo(QueryService.UNDEFINED);
  }
Can't test every possible combination so try the known, relevant ones.
geode-core/src/test/java/org/apache/geode/cache/query/internal/types/TypeUtilsJUnitTest.java