Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #254 Improve description when byte value is mismatched #255

Merged
merged 1 commit into from May 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions hamcrest/src/main/java/org/hamcrest/BaseDescription.java
Expand Up @@ -35,6 +35,10 @@ public Description appendValue(Object value) {
append('"');
toJavaSyntax((Character) value);
append('"');
} else if (value instanceof Byte) {
append('<');
append(descriptionOf(value));
append("b>");
} else if (value instanceof Short) {
append('<');
append(descriptionOf(value));
Expand Down
6 changes: 6 additions & 0 deletions hamcrest/src/test/java/org/hamcrest/BaseDescriptionTest.java
Expand Up @@ -62,6 +62,12 @@ public final class BaseDescriptionTest {
assertEquals("\"\\\"\"", result.toString());
}

@Test public void
bracketsAppendedByteValue() {
baseDescription.appendValue(Byte.valueOf("2"));
assertEquals("<2b>", result.toString());
}

@Test public void
bracketsAppendedShortValue() {
baseDescription.appendValue(Short.valueOf("2"));
Expand Down