-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 #18226 from mkouba/issue-18200
- Loading branch information
Showing
5 changed files
with
72 additions
and
6 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
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
53 changes: 53 additions & 0 deletions
53
.../tests/src/test/java/io/quarkus/arc/test/decorators/validation/NonDependentScopeTest.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,53 @@ | ||
package io.quarkus.arc.test.decorators.validation; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import io.quarkus.arc.test.ArcTestContainer; | ||
import javax.annotation.Priority; | ||
import javax.decorator.Decorator; | ||
import javax.decorator.Delegate; | ||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.inject.Inject; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
public class NonDependentScopeTest { | ||
|
||
@RegisterExtension | ||
public ArcTestContainer container = ArcTestContainer.builder() | ||
.beanClasses(Converter.class, DecoratorWithWrongScope.class).shouldFail().build(); | ||
|
||
@Test | ||
public void testFailure() { | ||
assertNotNull(container.getFailure()); | ||
assertTrue( | ||
container.getFailure().getMessage() | ||
.contains( | ||
"A decorator must be @Dependent but io.quarkus.arc.test.decorators.validation.NonDependentScopeTest$DecoratorWithWrongScope declares javax.enterprise.context.ApplicationScoped"), | ||
container.getFailure().getMessage()); | ||
} | ||
|
||
interface Converter<T, U> { | ||
|
||
T convert(T value); | ||
|
||
} | ||
|
||
@ApplicationScoped | ||
@Priority(1) | ||
@Decorator | ||
static class DecoratorWithWrongScope implements Converter<String, String> { | ||
|
||
@Inject | ||
@Delegate | ||
Converter<String, String> delegate; | ||
|
||
@Override | ||
public String convert(String value) { | ||
return null; | ||
} | ||
|
||
} | ||
|
||
} |