Skip to content

Commit

Permalink
Merge pull request #27688 from loicmathieu/jsonb-restassures
Browse files Browse the repository at this point in the history
Manually serialize the Pojo in the PojoResourceTest and enable it
  • Loading branch information
gsmet authored Sep 5, 2022
2 parents e904fcb + aed0385 commit 7f6a45b
Showing 1 changed file with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@

import java.util.Optional;

import javax.json.bind.Jsonb;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import io.quarkus.it.mongodb.pojo.Pojo;
import io.quarkus.test.common.QuarkusTestResource;
Expand All @@ -19,14 +24,21 @@

@QuarkusTest
@QuarkusTestResource(MongoTestResource.class)
//@DisabledOnOs(OS.WINDOWS)
// This test is disabled but should only be disable on Windows (as with other MongoDB tests) due an issue at Yasson
// side https://github.com/eclipse-ee4j/yasson/issues/575.
// The Jakarata EE migration upgrades to Yasson 3.0.1 that contains the issue so we temporarily disable this test.
// To avoid forgetting it forever an issue has been created, see https://github.com/quarkusio/quarkus/issues/27619.
@Disabled
@DisabledOnOs(OS.WINDOWS)
public class PojoResourceTest {

private static Jsonb jsonb;

@BeforeAll
public static void giveMeAMapper() {
jsonb = Utils.initialiseJsonb();
}

@AfterAll
public static void releaseMapper() throws Exception {
jsonb.close();
}

@BeforeEach
public void clearCollection() {
Response response = RestAssured
Expand All @@ -41,7 +53,8 @@ public void testPojoEndpoint() {
Pojo pojo = new Pojo();
pojo.description = "description";
pojo.optionalString = Optional.of("optional");
given().header("Content-Type", "application/json").body(pojo)
given().header("Content-Type", "application/json")
.body(jsonb.toJson(pojo))
.when().post("/pojos")
.then().statusCode(201);

Expand Down

0 comments on commit 7f6a45b

Please sign in to comment.