-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REST Data Panache dev mode fix #9510
- Loading branch information
Gytis Trikleris
committed
Jul 2, 2020
1 parent
288f5b8
commit 8349173
Showing
3 changed files
with
53 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...ment/src/test/java/io/quarkus/hibernate/orm/rest/data/panache/deployment/DevModeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package io.quarkus.hibernate.orm.rest.data.panache.deployment; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static io.restassured.RestAssured.when; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.hibernate.orm.rest.data.panache.deployment.entity.Collection; | ||
import io.quarkus.hibernate.orm.rest.data.panache.deployment.entity.Item; | ||
import io.quarkus.hibernate.orm.rest.data.panache.deployment.entity.ItemsController; | ||
import io.quarkus.test.QuarkusDevModeTest; | ||
import io.restassured.response.Response; | ||
|
||
public class DevModeTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusDevModeTest TEST = new QuarkusDevModeTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(Collection.class, Item.class, ItemsController.class) | ||
.addAsResource("application.properties") | ||
.addAsResource("import.sql")); | ||
|
||
@Test | ||
void testGet() { | ||
when().get("/items/1") | ||
.then().statusCode(200); | ||
} | ||
|
||
@Test | ||
void testCreate() { | ||
Response response = given().body("{\"name\": \"test\", \"collection\": {\"name\": \"full\"}}") | ||
.and().contentType("application/json") | ||
.when().post("/items") | ||
.thenReturn(); | ||
assertThat(response.getStatusCode()).isEqualTo(201); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters