Reputation: 411
I am trying to write integration tests for Quarkus using Mockito, but I fail using Argument captor. Here is a minimal (not) working example :
@QuarkusTest
@ExtendWith(MockitoExtension.class)
public class SimpleTest {
@Captor
private ArgumentCaptor<Context> contextArgumentCaptor;
@Test
public void testOne() {
System.out.println(contextArgumentCaptor);
}
}
contextArgumentCaptor is "null". If I remove @QuarkusTest, contextArgumentCaptor is created.
It also works with @QuarkusTest and direct Argument creator :
@QuarkusTest
public class ConfigTest {
private ArgumentCaptor<Context> contextArgumentCaptor;
@BeforeEach
public void setup() {
contextArgumentCaptor = ArgumentCaptor.forClass(Context.class);
}
@Test
public void givenValidCloudEvent_whenHandleHandoverFunction_ThenHandoverStarted() {
System.out.println(contextArgumentCaptor);
}
}
So it is really the combinaison of @QuarkusTest with @Captor that doesn't work.
Any idea?
Upvotes: 2
Views: 1026
Reputation: 63991
Yes, using @QuarkusTest
along with the @Captor
will not work correctly. You must create the captor yourself
Upvotes: 2