Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public Condition<Object> apply(Method readMethod, Description mismatch) {
return notMatched();
} catch (Exception e) {
throw new IllegalStateException(
"Calling: '" + readMethod + "' should not have thrown " + e);
"Calling: '" + readMethod + "' should not have thrown", e);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
package org.hamcrest.beans;

import org.hamcrest.*;
import org.hamcrest.AbstractMatcherTest;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
import org.hamcrest.core.IsEqual;

import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
import java.nio.file.Path;
import java.nio.file.Paths;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasToString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.beans.HasPropertyWithValue.hasProperty;
import static org.hamcrest.beans.HasPropertyWithValue.hasPropertyAtPath;
Expand Down Expand Up @@ -71,6 +77,11 @@ public void testMatchesPath() {
assertMismatchDescription("inner.inner.property.was \"not expected\"", hasPropertyAtPath("inner.inner.property", equalTo("something")), new BeanWithInner(new BeanWithInner(shouldNotMatch)));
}

public void testMatchesAbstract() {
Path path = Paths.get("hi.txt");
assertThat(path, hasProperty("fileName", hasToString("hi.txt")));
}

public void testDescribeTo() {
assertDescription("hasProperty(\"property\", <true>)", hasProperty("property", equalTo(true)));
}
Expand Down