Search in sources :

Example 1 with BasicController

use of com.qcadoo.mes.basic.controllers.BasicController in project mes by qcadoo.

the class BasicControllerTest method shouldPrepareViewForParameters.

@Test
public void shouldPrepareViewForParameters() throws Exception {
    // // given
    Map<String, String> arguments = ImmutableMap.of("context", "{\"form.id\":\"13\"}");
    ModelAndView expectedMav = mock(ModelAndView.class);
    CrudService crudController = mock(CrudService.class);
    given(crudController.prepareView(BasicConstants.PLUGIN_IDENTIFIER, BasicConstants.VIEW_GENERAL_PARAMETERS, arguments, Locale.ENGLISH)).willReturn(expectedMav);
    ParameterService parameterService = mock(ParameterService.class);
    given(parameterService.getParameterId()).willReturn(13L);
    BasicController basicController = new BasicController();
    setField(basicController, "crudService", crudController);
    setField(basicController, "parameterService", parameterService);
    // // when
    ModelAndView mav = basicController.getGeneralParameterPageView(Locale.ENGLISH);
    // // then
    assertEquals(expectedMav, mav);
}
Also used : CrudService(com.qcadoo.view.api.crud.CrudService) ModelAndView(org.springframework.web.servlet.ModelAndView) BasicController(com.qcadoo.mes.basic.controllers.BasicController) Test(org.junit.Test)

Aggregations

BasicController (com.qcadoo.mes.basic.controllers.BasicController)1 CrudService (com.qcadoo.view.api.crud.CrudService)1 Test (org.junit.Test)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1