forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow conditional annotations and declarative filter annotations o…
…n methods Although we can make this work in the future, it involves a fair amount of work for a very small gain, so let's make it explicit for now that this combination is not allowed. Follows up on: quarkusio#29118
- Loading branch information
Showing
2 changed files
with
71 additions
and
0 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
62 changes: 62 additions & 0 deletions
62
...rkus/resteasy/reactive/server/test/customproviders/InvalidConditionalBeanFiltersTest.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,62 @@ | ||
package io.quarkus.resteasy.reactive.server.test.customproviders; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.UriInfo; | ||
|
||
import org.jboss.resteasy.reactive.server.ServerRequestFilter; | ||
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.arc.profile.IfBuildProfile; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class InvalidConditionalBeanFiltersTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setArchiveProducer(new Supplier<>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(TestResource.class, Filters.class); | ||
} | ||
}).assertException(t -> { | ||
String message = t.getMessage(); | ||
assertTrue(message.contains("@IfBuildProfile")); | ||
assertTrue(message.contains("request")); | ||
assertTrue(message.contains(InvalidConditionalBeanFiltersTest.Filters.class.getName())); | ||
}); | ||
|
||
@Test | ||
public void test() { | ||
fail("Should never have been called"); | ||
} | ||
|
||
@Path("test") | ||
public static class TestResource { | ||
|
||
@GET | ||
public String hello() { | ||
return "hello"; | ||
} | ||
|
||
} | ||
|
||
public static class Filters { | ||
|
||
@IfBuildProfile("test") | ||
@ServerRequestFilter | ||
public void request(UriInfo info) { | ||
|
||
} | ||
|
||
} | ||
} |