Skip to content

Commit

Permalink
fix quality violations
Browse files Browse the repository at this point in the history
  • Loading branch information
uchitsa committed Dec 10, 2024
1 parent 3b38b79 commit 90cc8f3
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ void canReadJsonDocument() throws IOException {
.withBody("{\n\t\r\"foo-foo\":2,\n\"bar\":\"\u20ac\"}")
.fetch().as(JacksonResponse.class);
MatcherAssert.assertThat(
"should be 2",
response.json().read().path("foo-foo").asInt(),
Matchers.equalTo(2)
);
MatcherAssert.assertThat(
"should be '\u20ac'",
response.json().read().path("bar").asText(),
Matchers.equalTo("\u20ac")
);
Expand All @@ -76,6 +78,7 @@ void canParseUnquotedControlCharacters() throws IOException {
.withBody("{\"test\":\n\"\u001Fblah\uFFFDcwhoa\u0000!\"}")
.fetch().as(JacksonResponse.class);
MatcherAssert.assertThat(
"should be '\u001Fblah\uFFFDcwhoa\u0000!'",
response.json().readObject().get("test").asText(),
Matchers.is("\u001Fblah\uFFFDcwhoa\u0000!")
);
Expand All @@ -94,6 +97,7 @@ void invalidJsonErrorHandlingIsLeftToJackson() throws IOException {
final JacksonResponse response = new FakeRequest()
.withBody(body).fetch().as(JacksonResponse.class);
MatcherAssert.assertThat(
"should contains error 'was expecting double-quote to start field name'",
Assertions.assertThrows(
IOException.class,
new Executable() {
Expand Down Expand Up @@ -123,6 +127,7 @@ void invalidJsonArrayErrorHandlingIsLeftToJackson()
.withBody("{\"anInvalidArrayTest\":[}")
.fetch().as(JacksonResponse.class);
MatcherAssert.assertThat(
"should contains error 'Unexpected close marker'",
Assertions.assertThrows(
IOException.class,
new Executable() {
Expand All @@ -149,6 +154,7 @@ void cannotReadJsonAsArrayIfNotOne() throws IOException {
.withBody("{\"objectIsNotArray\": \"It's not!\"}")
.fetch().as(JacksonResponse.class);
MatcherAssert.assertThat(
"should contains 'Cannot read as an array. The JSON is not a valid array.'",
Assertions.assertThrows(
IOException.class,
new Executable() {
Expand Down

0 comments on commit 90cc8f3

Please sign in to comment.