aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java b/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
index 09258af..2d70d3e 100644
--- a/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
+++ b/src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java
@@ -53,7 +53,11 @@ public class DeepReflectionMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
}
if (expected instanceof String) {
- return matchesString(path, expected, actual, mismatchDescription);
+ return matchesPrimitive(path, expected, actual, mismatchDescription);
+ }
+
+ if (expected instanceof Boolean) {
+ return matchesPrimitive(path, expected, actual, mismatchDescription);
}
for (Field field : fields(expected.getClass())) {
@@ -139,7 +143,7 @@ public class DeepReflectionMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
return true;
}
- private static <T> boolean matchesString(String path, T expected, T actual, Description mismatchDescription) {
+ private static <T> boolean matchesPrimitive(String path, T expected, T actual, Description mismatchDescription) {
Matcher<Object> matcher = Matchers.equalTo(expected);
if (!matcher.matches(actual)) {
appendPath(mismatchDescription, path);
@@ -160,7 +164,7 @@ public class DeepReflectionMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
}
private static String describeValue(Object value) {
- if (value instanceof String) {
+ if (value instanceof String || value instanceof Boolean) {
return value.toString();
} else if (value instanceof Optional) {
Optional<?> optional = (Optional)value;