-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InjectMock does not work on observer method #11079
Comments
From @mkouba
|
I don't want to repeat the discussion from the zulip chat. I'll convert this to an enhancement instead of closing it (via the discussed documentation update PR) because that would look misleading in the next changelog. |
It seems I am not allowed to do that. @geoand WDYT? |
You mean you can't change labels? |
I don't really now what the exact permissions are (I'm not an admin of the repo) |
@famod I get your point. I think that we could try to temporarily disable all observers declared on mocked beans. I'll do some POC and we'll see how it goes... |
- also rename MockableProxy to Mockable and remove it from the public API - resolves quarkusio#11079
- also rename MockableProxy to Mockable and remove it from the public API - resolves quarkusio#11079
- also rename MockableProxy to Mockable and remove it from the public API - resolves quarkusio#11079
Describe the bug
Mocking a bean with
@io.quarkus.test.junit.mockito.InjectMock
does not work for methods that use@Observes
.Example:
public void onExampleEvent(@Observes ExampleEvent event) {...}
This method is called when
ExampleEvent
is fired, even if the bean containing this method is mocked by using@InjectMock
.Hint: any other method of the same bean is mocked successfully.
Expected behavior
Actual behavior
To Reproduce
Steps to reproduce the behavior:
git clone -b quarkus-observer-mock https://github.com/mickroll/demonstrator.git
mvn clean install
Configuration
none
Screenshots
none
Environment (please complete the following information):
uname -a
orver
: Microsoft Windows [Version 10.0.18363.959]java -version
: openjdk version "11.0.7" 2020-04-14mvnw --version
orgradlew --version
): Apache Maven 3.6.3Additional context
the demonstrator was built similar to https://github.com/quarkusio/quarkus-quickstarts/tree/master/getting-started-testing
The text was updated successfully, but these errors were encountered: