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

Reintroduce lost tests in mongodb-client #20146

Merged
merged 1 commit into from
Sep 14, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.quarkus.it.mongodb;

import io.quarkus.it.mongodb.pojo.PojoResource;
import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class NativePojoResourceIT extends PojoResource {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.quarkus.it.mongodb;

import io.quarkus.test.junit.NativeImageTest;

@NativeImageTest
public class NativeVehicleResourceIT extends VehicleResourceTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.quarkus.it.mongodb;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

import java.util.Optional;

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;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.mongodb.MongoTestResource;

@QuarkusTest
@QuarkusTestResource(MongoTestResource.class)
@DisabledOnOs(OS.WINDOWS)
public class PojoResourceTest {
@Test
public void testPojoEndpoint() {
Pojo pojo = new Pojo();
pojo.description = "description";
pojo.optionalString = Optional.of("optional");
given().header("Content-Type", "application/json").body(pojo)
.when().post("/pojos")
.then().statusCode(201);

given().get("/pojos").then().statusCode(200).body("size()", is(1));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.quarkus.it.mongodb;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

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.discriminator.Car;
import io.quarkus.it.mongodb.discriminator.Moto;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.mongodb.MongoTestResource;

@QuarkusTest
@QuarkusTestResource(MongoTestResource.class)
@DisabledOnOs(OS.WINDOWS)
public class VehicleResourceTest {
@Test
public void testVehicleEndpoint() {
Car car = new Car();
car.name = "Renault Clio";
car.type = "CAR";
car.seatNumber = 5;
given().header("Content-Type", "application/json").body(car)
.when().post("/vehicles")
.then().statusCode(201);

Moto moto = new Moto();
moto.name = "Harley Davidson Sportster";
moto.type = "MOTO";
given().header("Content-Type", "application/json").body(moto)
.when().post("/vehicles")
.then().statusCode(201);

given().get("/vehicles").then().statusCode(200).body("size()", is(2));
}
}