-
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 - validate Event#select and Event#fire methods for type variables
- Loading branch information
Showing
4 changed files
with
64 additions
and
33 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
29 changes: 29 additions & 0 deletions
29
...endent-projects/arc/tests/src/test/java/io/quarkus/arc/test/event/fire/EventFireTest.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.arc.test.event.fire; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.arc.Arc; | ||
import io.quarkus.arc.test.ArcTestContainer; | ||
|
||
public class EventFireTest { | ||
|
||
@RegisterExtension | ||
public ArcTestContainer container = new ArcTestContainer(); | ||
|
||
@Test | ||
public <T> void testEventFireThrowsExceptionIfEventTypeHasTypeVariable() { | ||
Assertions.assertThrows(IllegalArgumentException.class, | ||
() -> Arc.container().beanManager().getEvent().select(BarInterface.class).fire(new Foo<T>()), | ||
"Event#fire should throw IllegalArgumentException if the payload contains unresolved type variable"); | ||
} | ||
|
||
public class Foo<T> implements BarInterface { | ||
|
||
} | ||
|
||
public interface BarInterface { | ||
|
||
} | ||
} |
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