Feature summary
The inverse of optional.hasValue() essentially the wrapped object not equal to.
Example
assertThat(Optional.of("foo"))
.isPresent()
.hasValue("foo")
.hasValueNotEqualTo("bar");
not and equalTo are the methods on java Predicate. Obviously this feature is not useful for this example, but included because it would compile ;)
assertThat(Optional.of("foo"))
.isPresent()
.hasValue("foo")
.hasValueSatisfying(new Condition<>(not(isEqual("bar")), "not equal to " + "bar"));
it is when values are dynamic though
var oid2 = commit(git);
assertThat(mb.find(origin))
.isPresent()
.hasValue(remoteHead.apply())
.hasValueSatisfying(new Condition<>(not(isEqual(oid2)), "not equal to " + oid2));
var oid2 = commit(git);
assertThat(mb.find(origin))
.isPresent()
.hasValue(remoteHead.apply())
.hasValueNotEqualTo(oid2);
Maybe an alternative would be to start developing a Conditions library (although maybe this is too much like hamcrest)
assertThat(Optional.of("foo"))
.isPresent()
.hasValue("foo")
.hasValueSatifying(Conditions.notEqual("bar"));
Feature summary
The inverse of
optional.hasValue()essentially the wrapped object not equal to.Example
notandequalToare the methods on javaPredicate. Obviously this feature is not useful for this example, but included because it would compile ;)it is when values are dynamic though
Maybe an alternative would be to start developing a Conditions library (although maybe this is too much like hamcrest)