-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate all web links in all classnames at once
- Loading branch information
1 parent
7cfd618
commit 13290d1
Showing
4 changed files
with
37 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
27 changes: 12 additions & 15 deletions
27
...java/io/quarkus/resteasy/reactive/links/deployment/RestLinksWithFailureInjectionTest.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 |
---|---|---|
@@ -1,31 +1,28 @@ | ||
package io.quarkus.resteasy.reactive.links.deployment; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import io.quarkus.runtime.util.ExceptionUtil; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.quarkus.test.common.http.TestHTTPResource; | ||
|
||
public class RestLinksWithFailureInjectionTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest TEST = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(TestRecordNoId.class, TestResourceNoId.class)); | ||
|
||
@TestHTTPResource("recordsNoId") | ||
String recordsUrl; | ||
.withApplicationRoot(jar -> jar.addClasses(TestRecordNoId.class, TestResourceNoId.class)).assertException(t -> { | ||
Throwable rootCause = ExceptionUtil.getRootCause(t); | ||
assertThat(rootCause).isInstanceOf(IllegalStateException.class) | ||
.hasMessageContaining("Cannot generate web links for the class(es) " + | ||
"io.quarkus.resteasy.reactive.links.deployment.TestRecordNoId because it does not contain an `id` field"); | ||
}); | ||
|
||
@Test | ||
void shouldReturnIllegalStateException() { | ||
String response = given().when() | ||
.get(recordsUrl + "/by-name/second_value") | ||
.getBody().asString(); | ||
assertThat(response) | ||
.contains("java.lang.IllegalStateException: Cannot generate web links for " + | ||
"io.quarkus.resteasy.reactive.links.deployment.TestRecordNoId because the class does not contain an `id` field"); | ||
void validationFailed(){ | ||
// Should not be reached: verify | ||
assertTrue(false); | ||
} | ||
} |
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