We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? No Sign in to your account
@validated with MockMVC is not working.
@RunWith(MockitoJUnitRunner.class) @Slf4j public class TestController { private MockMvc mvc; @Mock private TestService service; @InjectMocks private Controller controller; private ObjectMapper mapper = new ObjectMapper(); @Before public void setup() { // MockMvc standalone approach mvc = mvc = MockMvcBuilders.standaloneSetup(controller).setValidator(validator()).setControllerAdvice(new InvoiceServiceExceptionHandler()) .build(); } @Test public void whenNullValue_thenReturns400() throws JsonProcessingException, Exception { TestDTO testDTO = new TestDTO(); testDTO.setId(null); ArrayList<TestDTO> testList = new ArrayList<TestDTO>(Arrays.asList(testDTO)); String jsonTestList = mapper.writeValueAsString(testList); MvcResult responseMVC = mvc.perform(post("/v1/test").content(jsonTestList).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()).andReturn(); }
Originally posted by @SumithraPrasad in #16917 (comment)
The text was updated successfully, but these errors were encountered:
@SumithraPrasad there is no need to create a duplicate. #16917 is still open.
Sorry, something went wrong.
No branches or pull requests
@validated with MockMVC is not working.
Originally posted by @SumithraPrasad in #16917 (comment)
The text was updated successfully, but these errors were encountered: