Java Code Examples for org.hamcrest.core.IsEqual#equalTo()

The following examples show how to use org.hamcrest.core.IsEqual#equalTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomMatchers.java    From cukes with Apache License 2.0 6 votes vote down vote up
public static <T> Matcher<Optional<T>> equalToOptional(final T operand) {
    return new TypeSafeMatcher<Optional<T>>() {

        private Matcher<T> equalTo;

        @Override
        protected boolean matchesSafely(Optional<T> t) {
            if(t.isPresent()) {
                equalTo = IsEqual.equalTo(t.get());
                return equalTo.matches(operand);
            }
            return false;
        }

        @Override
        public void describeTo(Description description) {
            IsEqual.equalTo(equalTo).describeTo(description);
        }
    };
}
 
Example 2
Source File: CheckedMapProofMatcher.java    From exonum-java-binding with Apache License 2.0 5 votes vote down vote up
private CheckedMapProofMatcher(List<MapTestEntry> entries) {
  this.entries = entries;
  Set<MapEntry<ByteString, ByteString>> expectedEntries = getExpectedEntries();
  Set<ByteString> expectedMissingKeys = getExpectedMissingKeys();
  this.presentEntriesMatcher = IsEqual.equalTo(expectedEntries);
  this.missingKeysMatcher = IsEqual.equalTo(expectedMissingKeys);
}
 
Example 3
Source File: DatabaseValueMatchers.java    From claudb with MIT License 4 votes vote down vote up
public static Matcher<DatabaseValue> isString(String expected) {
  return IsEqual.equalTo(string(expected));
}
 
Example 4
Source File: DatabaseValueMatchers.java    From claudb with MIT License 4 votes vote down vote up
public static Matcher<DatabaseValue> isList(String ... expected) {
  return IsEqual.equalTo(list(expected));
}
 
Example 5
Source File: DatabaseValueMatchers.java    From claudb with MIT License 4 votes vote down vote up
public static Matcher<DatabaseValue> isSet(String ... expected) {
  return IsEqual.equalTo(set(expected));
}