forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#15073 from Sgitario/start_stop_prod
Add QuarkusProdModeTest start/stop methods and fix restassured random port
- Loading branch information
Showing
2 changed files
with
109 additions
and
25 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
42 changes: 42 additions & 0 deletions
42
test-framework/junit5-internal/src/test/java/io/quarkus/test/QuarkusProdModeTestTest.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,42 @@ | ||
package io.quarkus.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
public class QuarkusProdModeTestTest { | ||
@RegisterExtension | ||
static final QuarkusProdModeTest simpleApp = new QuarkusProdModeTest() | ||
.setApplicationName("simple-app") | ||
.setApplicationVersion("0.1-SNAPSHOT") | ||
.setRun(true); | ||
|
||
@Test | ||
public void shouldStartAndStopInnerProcess() { | ||
thenAppIsRunning(); | ||
|
||
whenStopApp(); | ||
thenAppIsNotRunning(); | ||
|
||
whenStartApp(); | ||
thenAppIsRunning(); | ||
} | ||
|
||
private void whenStopApp() { | ||
simpleApp.stop(); | ||
} | ||
|
||
private void whenStartApp() { | ||
simpleApp.start(); | ||
} | ||
|
||
private void thenAppIsNotRunning() { | ||
assertNotNull(simpleApp.getExitCode(), "App is running"); | ||
} | ||
|
||
private void thenAppIsRunning() { | ||
assertNull(simpleApp.getExitCode(), "App is not running"); | ||
} | ||
} |