### Question:
Subsumption { static Optional<Boolean> subsumes(final FeelExpression expression, final FeelExpression otherExpression, final Comparison comparison) { return FeelExpressions.caseOf(expression) .Empty_(Optional.of(true)) .Null_(FeelExpressions.caseOf(otherExpression).Null_(Optional.of(true)).otherwise_(Optional.of(false))) .BooleanLiteral((aBool) -> compareLiterals(aBool, FeelExpressions::getABoolean, otherExpression, comparison)) .DateLiteral((dateTime) -> compareLiterals(dateTime, FeelExpressions::getDateTime, otherExpression, comparison)) .DoubleLiteral((aDouble) -> compareLiterals(aDouble, FeelExpressions::getADouble, otherExpression, comparison)) .IntegerLiteral((integer) -> compareLiterals(integer, FeelExpressions::getAInteger, otherExpression, comparison)) .StringLiteral((string) -> compareLiterals(string, FeelExpressions::getString, otherExpression, eq)) .VariableLiteral((name) -> subsumesVariableLiteral(name, otherExpression, comparison)) .RangeExpression((leftInc, lowerBound, upperBound, rightInc) -> subsumesRangeExpression(leftInc, lowerBound, upperBound, rightInc, otherExpression)) .UnaryExpression((operator, operand) -> subsumesUnaryExpression(operator, operand, otherExpression)) .otherwise_(Optional.empty()); }    }### Answer:
@Test void emptySubsumesEmpty() { final FeelExpression emptyExpression = FeelExpressions.Empty(); assertEquals(Optional.of(true), Subsumption.subsumes(emptyExpression, emptyExpression, Subsumption.eq)); }
@Test void nullSubsumesNull() { final FeelExpression nullExpression = FeelExpressions.Null(); assertEquals(Optional.of(true), Subsumption.subsumes(nullExpression, nullExpression, Subsumption.eq)); }
@Test void identicalStringsSubsumeEachOther() { final FeelExpression stringExpression = FeelParser.PARSER.parse("\"somestring\""); assertEquals(Optional.of(true), Subsumption.subsumes(stringExpression, stringExpression, Subsumption.eq)); }
@Test void differentStringsDoNotSubsumeEachOther() { final FeelExpression stringExpression = FeelParser.PARSER.parse("\"somestring\""); final FeelExpression otherStringExpression = FeelParser.PARSER.parse("\"otherstring\""); assertEquals(Optional.of(false), Subsumption.subsumes(stringExpression, otherStringExpression, Subsumption.eq)); }