Jukito
Jukito copied to clipboard
@UseModules on test method does not create mocks
I am trying to create a test where I have a @UseModules on a test mode to setup a dependency different from other test methods. But as a consequence objects are not mocked as is the case with using the @UseModules on the test class.
This unit test show It in action. The testWithoutUseModules gets a mocked HttpServletRequest, while the testWithUseModules gives a Guice error that no implementation was bound for the HttpServletRequest parameter. Maybe I am misreading or misunderstanding it.
@RunWith(JukitoRunner.class)
@UseModules(MockingTest.ModuleA.class)
public class MockingTest {
@Test
public void testWithoutUseModules(HttpServletRequest request) {
assertNotNull(request);
}
@Test
@UseModules(ModuleB.class)
public void testWithUseModules(HttpServletRequest request) {
assertNotNull(request);
}
public static class ModuleA extends AbstractModule {
@Override
protected void configure() {
}
}
public static class ModuleB extends AbstractModule {
@Override
protected void configure() {
}
}
}
No response to this bug report ?