use of com.tyndalehouse.step.rest.controllers.BibleController in project step by STEPBible.
the class FrontControllerTest method testInvokeMethod.
/**
* We check that invoke method calls the correct controller and method with the right arguments
*/
@Test
public void testInvokeMethod() throws Exception {
final StepRequest sr = new StepRequest("blah", "bible", "getAllFeatures", new String[] {});
final BibleController testController = mock(BibleController.class);
final FrontController fc = spy(this.fcUnderTest);
doReturn(testController).when(fc).getController("bible", false);
// do test
fc.invokeMethodWithStepRequest(sr);
// verify
verify(testController).getAllFeatures();
}
use of com.tyndalehouse.step.rest.controllers.BibleController in project step by STEPBible.
the class FrontControllerTest method testGetController.
/**
* tests the get controller method
*/
@Test
public void testGetController() {
final String controllerName = "Bible";
final BibleController mockController = mock(BibleController.class);
when(this.guiceInjector.getInstance(BibleController.class)).thenReturn(mockController);
// when
final Object controller = this.fcUnderTest.getController(controllerName, false);
// then
assertEquals(controller.getClass(), mockController.getClass());
}
use of com.tyndalehouse.step.rest.controllers.BibleController in project step by STEPBible.
the class FrontControllerTest method testGetControllerMethod.
/**
* tests that resolving method works
*
* @throws IllegalAccessException uncaught exception
* @throws InvocationTargetException uncaught exception
*/
@Test
public void testGetControllerMethod() throws IllegalAccessException, InvocationTargetException {
final BibleInformationService bibleInfo = mock(BibleInformationService.class);
final BibleController controllerInstance = new BibleController(bibleInfo, this.clientSessionProvider, null);
// when
final Method controllerMethod = this.fcUnderTest.getControllerMethod("getAllFeatures", controllerInstance, null, null);
// then
controllerMethod.invoke(controllerInstance);
verify(bibleInfo).getAllFeatures();
}
Aggregations