-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Coverage for mixing @QuarkusMainTest and @QuarkusTest in the same pac…
…kage Required for https://issues.redhat.com/browse/QUARKUS-2789 Names of the tests are important, see the first comment to the issue
- Loading branch information
Showing
4 changed files
with
56 additions
and
2 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
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
21 changes: 21 additions & 0 deletions
21
lifecycle-application/src/test/java/io/quarkus/ts/lifecycle/AlphabeticallyFirstTest.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,21 @@ | ||
package io.quarkus.ts.lifecycle; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
public class AlphabeticallyFirstTest { | ||
|
||
@Test | ||
public void shouldBeOk() { | ||
given() | ||
.when().get("/args") | ||
.then() | ||
.statusCode(200) | ||
.body(is("")); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
lifecycle-application/src/test/java/io/quarkus/ts/lifecycle/HelloMainTest.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,29 @@ | ||
package io.quarkus.ts.lifecycle; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.main.Launch; | ||
import io.quarkus.test.junit.main.LaunchResult; | ||
import io.quarkus.test.junit.main.QuarkusMainTest; | ||
|
||
@QuarkusMainTest | ||
public class HelloMainTest { | ||
|
||
@Test | ||
@Launch({ "cli", "Hello", "World" }) | ||
public void annotatedLaunch(LaunchResult result) { | ||
List<String> outputStream = result.getOutputStream(); | ||
String args = null; | ||
for (String output : outputStream) { | ||
if (output.contains("Received arguments:")) { | ||
args = output; | ||
} | ||
} | ||
Assertions.assertNotNull(args); | ||
Assertions.assertTrue(args.contains("Hello"), "No 'Hello' in the output!"); | ||
Assertions.assertTrue(args.contains("World"), "No 'World' in the output!"); | ||
} | ||
} |