spring frmawork test: Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

spring framework test

message

Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

 

solution

add View file's extension name;

like bellow

@Before
public void setUp() throws Exception
MockitoAnnotations.initMocks(this); //init controller and mocks
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setSuffix(".html");
mockMVC = MockMvcBuilders.standaloneSetup(productController)
.setViewResolvers(viewResolver)
.build();

댓글

가장 많이 본 글