QueryToKeyMatcher { @Nonnull private Match unexpected(@Nonnull KeyExpression key) { throw new KeyExpression.InvalidExpressionException("Unexpected Key Expression type " + key.getClass()); } QueryToKeyMatcher(@Nonnull QueryComponent rootQuery); @Nonnull Match matchesCoveringKey(@Nonnull KeyExpression expression); @Nonnull Match matchesCoveringKey(@Nonnull KeyExpression expression, @Nullable FilterSatisfiedMask filterMask); @Nonnull Match matchesSatisfyingQuery(@Nonnull KeyExpression expression); @Nonnull Match matchesSatisfyingQuery(@Nonnull KeyExpression expression, @Nullable FilterSatisfiedMask filterMask); @Nonnull @Deprecated Match matches(@Nonnull KeyExpression expression);  }
@Test public void testUnexpected() { assertUnexpected(queryField("a").equalsValue(1), UnknownKeyExpression.UNKNOWN); assertUnexpected(queryField("a").oneOfThem().equalsValue(1), UnknownKeyExpression.UNKNOWN); assertUnexpected( queryField("p").matches(queryField("b").equalsValue(1)), UnknownKeyExpression.UNKNOWN); assertUnexpected( queryField("p").oneOfThem().matches(queryField("b").equalsValue(1)), UnknownKeyExpression.UNKNOWN); assertUnexpected( queryField("p").matches(queryField("b").equalsValue(1)), keyField("p").nest(UnknownKeyExpression.UNKNOWN)); assertUnexpected( queryField("p").oneOfThem().matches(queryField("b").equalsValue(1)), keyField("p", FanType.FanOut).nest(UnknownKeyExpression.UNKNOWN)); assertUnexpected( Query.and(Query.field("a").equalsValue(1), Query.field("b").equalsValue(2)), concat(keyField("a"), UnknownKeyExpression.UNKNOWN)); assertUnexpected( new RecordTypeKeyComparison("DummyRecordType"), UnknownKeyExpression.UNKNOWN); }