-
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.
Merge pull request #34059 from mkouba/componenttest-superclasses
QuarkusComponentTest: collect injection points from superclasses
- Loading branch information
Showing
5 changed files
with
63 additions
and
10 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
21 changes: 21 additions & 0 deletions
21
...omponent/src/test/java/io/quarkus/test/component/declarative/SuperClassInjectionTest.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,21 @@ | ||
package io.quarkus.test.component.declarative; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mockito; | ||
|
||
import io.quarkus.test.component.QuarkusComponentTest; | ||
import io.quarkus.test.component.TestConfigProperty; | ||
|
||
@QuarkusComponentTest | ||
@TestConfigProperty(key = "foo", value = "BAR") | ||
public class SuperClassInjectionTest extends SuperTest { | ||
|
||
@Test | ||
public void testPing() { | ||
Mockito.when(charlie.ping()).thenReturn("foo"); | ||
assertEquals("foo and BAR", myComponent.ping()); | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
...ework/junit5-component/src/test/java/io/quarkus/test/component/declarative/SuperTest.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,17 @@ | ||
package io.quarkus.test.component.declarative; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import io.quarkus.test.InjectMock; | ||
import io.quarkus.test.component.beans.Charlie; | ||
import io.quarkus.test.component.beans.MyComponent; | ||
|
||
public abstract class SuperTest { | ||
|
||
@Inject | ||
MyComponent myComponent; | ||
|
||
@InjectMock | ||
Charlie charlie; | ||
|
||
} |