You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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() {
}
}
}
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: