protected void redirectToHomePage(String storeId, String langId, String CatalogId, ModelAndView modelAndView, String topCategoryId, запрос HttpServletRequest) {< /p>
Код: Выделить всё
StringBuilder viewName = new StringBuilder();
viewName.append("Redirect:StoreView?Id=190");
modelAndView.setViewName(viewName.toString());
Мой тестовый класс выглядит так.
публичный класс ANFCategoryDisplayBrowsingViewControllerTest {
Код: Выделить всё
@Test
public void TestRedirect() {
ANFCategoryDisplayBrowsingViewController categoryController = new ANFCategoryDisplayBrowsingViewController();
MockHttpServletRequest mockRequest = new MockHttpServletRequest();
categoryController.redirectToHomePage("10051", "-1", "10901", modelAndView, "10001", mockRequest);
assertEquals( "Redirect:StoreView?Id=190",modelAndView.getViewName());
}
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/791 ... -parameter