Skip to content

Commit 4277a9c

Browse files
committed
test: Add test for dynamic updates of OpenAPI files in development mode
1 parent 1c80ab0 commit 4277a9c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

moqu/deployment/src/test/java/io/quarkiverse/openapi/generator/MoquProjectProcessorTest.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
public class MoquProjectProcessorTest {
1111

12+
private static final String WIREMOCK_MAPPINGS_JSON_PATH = "/q/moqu/json/api/wiremock-mappings.json";
13+
1214
@RegisterExtension
1315
static final QuarkusDevModeTest unitTest = new QuarkusDevModeTest()
1416
.withApplicationRoot(javaArchive -> javaArchive
@@ -38,10 +40,27 @@ void testModeAsDownload() {
3840
@Test
3941
void testModeAsDownloadUsingJson() {
4042
RestAssured.given()
41-
.when().get("/q/moqu/json/api/wiremock-mappings.json")
43+
.when().get(WIREMOCK_MAPPINGS_JSON_PATH)
4244
.then()
4345
.statusCode(200)
4446
.body(Matchers.containsString("Alice"))
4547
.log().ifError();
4648
}
49+
50+
@Test
51+
void testDevModeWatchOpenApiFiles() {
52+
RestAssured.given()
53+
.when().get(WIREMOCK_MAPPINGS_JSON_PATH)
54+
.then()
55+
.statusCode(200)
56+
.body(Matchers.containsString("80"));
57+
58+
unitTest.modifyResourceFile("openapi/api.json", (content) -> content.replace("80", "77"));
59+
60+
RestAssured.given()
61+
.when().get(WIREMOCK_MAPPINGS_JSON_PATH)
62+
.then()
63+
.statusCode(200)
64+
.body(Matchers.containsString("77"));
65+
}
4766
}

0 commit comments

Comments
 (0)