Skip to content

Commit

Permalink
Merge pull request quarkusio#43064 from luneo7/fix-serializer
Browse files Browse the repository at this point in the history
Fix Boolean serializer
  • Loading branch information
geoand authored Sep 6, 2024
2 parents 9dabb68 + c9e6130 commit fe706f2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ String writtenType() {
case "java.lang.Long" -> "long";
case "java.lang.Double" -> "double";
case "java.lang.Float" -> "float";
case "java.lang.Boolean" -> "boolean";
default -> fieldType.name().toString();
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,22 @@ public class Dog extends AbstractNamedPet {
@JsonProperty("age")
private int publicAge;

@JsonProperty("vaccinated")
private Boolean publicVaccinated;

public int getPublicAge() {
return publicAge;
}

public void setPublicAge(int publicAge) {
this.publicAge = publicAge;
}

public Boolean getPublicVaccinated() {
return publicVaccinated;
}

public void setPublicVaccinated(Boolean publicVaccinated) {
this.publicVaccinated = publicVaccinated;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ private static Dog createDog() {
dog.setPrivateName("Jack");
dog.setPublicName("Leo");
dog.setVeterinarian(createVeterinarian());
dog.setPublicVaccinated(true);
return dog;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ private static void testSecuredFieldOnAbstractClass(String catPath, String dogPa
public void testEcho() {
RestAssured
.with()
.body("{\"publicName\":\"Leo\",\"veterinarian\":{\"name\":\"Dolittle\"},\"age\":5}")
.body("{\"publicName\":\"Leo\",\"veterinarian\":{\"name\":\"Dolittle\"},\"age\":5,\"vaccinated\":true}")
.contentType("application/json; charset=utf-8")
.post("/simple/dog-echo")
.then()
Expand All @@ -670,6 +670,7 @@ public void testEcho() {
.body("publicName", Matchers.is("Leo"))
.body("privateName", Matchers.nullValue())
.body("age", Matchers.is(5))
.body("vaccinated", Matchers.is(true))
.body("veterinarian.name", Matchers.is("Dolittle"))
.body("veterinarian.title", Matchers.nullValue());
}
Expand Down

0 comments on commit fe706f2

Please sign in to comment.