From 15127cb39b2014dd7b2218fafcba970045ddadef Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 13 Feb 2016 17:45:31 +0000 Subject: Read numbering from parapgraph properties --- .../java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/test/java/org/zwobble/mammoth/tests/DeepReflectionMatcher.java') 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 extends TypeSafeDiagnosingMatcher { } 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 extends TypeSafeDiagnosingMatcher { return true; } - private static boolean matchesString(String path, T expected, T actual, Description mismatchDescription) { + private static boolean matchesPrimitive(String path, T expected, T actual, Description mismatchDescription) { Matcher matcher = Matchers.equalTo(expected); if (!matcher.matches(actual)) { appendPath(mismatchDescription, path); @@ -160,7 +164,7 @@ public class DeepReflectionMatcher extends TypeSafeDiagnosingMatcher { } 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; -- cgit v1.2.3