-
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.
Arc - Using @typed with illegal values should throw an exception
- Loading branch information
Showing
9 changed files
with
142 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
25 changes: 25 additions & 0 deletions
25
...ts/arc/tests/src/test/java/io/quarkus/arc/test/resolution/broken/BrokenTypedBeanTest.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,25 @@ | ||
package io.quarkus.arc.test.resolution.broken; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import javax.enterprise.inject.spi.DefinitionException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.test.ArcTestContainer; | ||
|
||
public class BrokenTypedBeanTest { | ||
|
||
@RegisterExtension | ||
public ArcTestContainer container = ArcTestContainer.builder().beanClasses(MyBean.class, MyOtherBean.class).shouldFail() | ||
.build(); | ||
|
||
@Test | ||
public void testFailure() { | ||
Throwable error = container.getFailure(); | ||
assertNotNull(error); | ||
assertTrue(error instanceof DefinitionException); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...sts/src/test/java/io/quarkus/arc/test/resolution/broken/BrokenTypedProducerFieldTest.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,26 @@ | ||
package io.quarkus.arc.test.resolution.broken; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import javax.enterprise.inject.spi.DefinitionException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.test.ArcTestContainer; | ||
|
||
public class BrokenTypedProducerFieldTest { | ||
|
||
@RegisterExtension | ||
public ArcTestContainer container = ArcTestContainer.builder() | ||
.beanClasses(FieldProducerBean.class, MyOtherBean.class, ProducedBean.class).shouldFail() | ||
.build(); | ||
|
||
@Test | ||
public void testFailure() { | ||
Throwable error = container.getFailure(); | ||
assertNotNull(error); | ||
assertTrue(error instanceof DefinitionException); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...ts/src/test/java/io/quarkus/arc/test/resolution/broken/BrokenTypedProducerMethodTest.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,26 @@ | ||
package io.quarkus.arc.test.resolution.broken; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import javax.enterprise.inject.spi.DefinitionException; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.test.ArcTestContainer; | ||
|
||
public class BrokenTypedProducerMethodTest { | ||
|
||
@RegisterExtension | ||
public ArcTestContainer container = ArcTestContainer.builder() | ||
.beanClasses(MethodProducerBean.class, MyOtherBean.class, ProducedBean.class).shouldFail() | ||
.build(); | ||
|
||
@Test | ||
public void testFailure() { | ||
Throwable error = container.getFailure(); | ||
assertNotNull(error); | ||
assertTrue(error instanceof DefinitionException); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ects/arc/tests/src/test/java/io/quarkus/arc/test/resolution/broken/FieldProducerBean.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,15 @@ | ||
package io.quarkus.arc.test.resolution.broken; | ||
|
||
import javax.enterprise.context.Dependent; | ||
import javax.enterprise.inject.Produces; | ||
import javax.enterprise.inject.Typed; | ||
|
||
@Dependent | ||
public class FieldProducerBean { | ||
|
||
@Produces | ||
@Typed(value = MyOtherBean.class) | ||
public ProducedBean produceBean() { | ||
return new ProducedBean(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...cts/arc/tests/src/test/java/io/quarkus/arc/test/resolution/broken/MethodProducerBean.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,15 @@ | ||
package io.quarkus.arc.test.resolution.broken; | ||
|
||
import javax.enterprise.context.Dependent; | ||
import javax.enterprise.inject.Produces; | ||
import javax.enterprise.inject.Typed; | ||
|
||
@Dependent | ||
public class MethodProducerBean { | ||
|
||
@Produces | ||
@Typed(value = MyOtherBean.class) | ||
public ProducedBean produceBean() { | ||
return new ProducedBean(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...endent-projects/arc/tests/src/test/java/io/quarkus/arc/test/resolution/broken/MyBean.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,9 @@ | ||
package io.quarkus.arc.test.resolution.broken; | ||
|
||
import javax.enterprise.context.Dependent; | ||
import javax.enterprise.inject.Typed; | ||
|
||
@Dependent | ||
@Typed(value = MyOtherBean.class) | ||
public class MyBean { | ||
} |
7 changes: 7 additions & 0 deletions
7
...t-projects/arc/tests/src/test/java/io/quarkus/arc/test/resolution/broken/MyOtherBean.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,7 @@ | ||
package io.quarkus.arc.test.resolution.broken; | ||
|
||
import javax.enterprise.context.Dependent; | ||
|
||
@Dependent | ||
public class MyOtherBean { | ||
} |
4 changes: 4 additions & 0 deletions
4
...-projects/arc/tests/src/test/java/io/quarkus/arc/test/resolution/broken/ProducedBean.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,4 @@ | ||
package io.quarkus.arc.test.resolution.broken; | ||
|
||
public class ProducedBean { | ||
} |