Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. @GetMapping(value="")
  2. public ResponseEntity<JsonResponse> getLocations(@RequestHeader(value="id") String id, @LocationType @RequestParam(value="locationType" ) String P_STS_AREA_TYP) {
  3.  
  4. ...
  5. return new ResponseEntity<>(response,HttpStatus.OK);
  6. }
  7.  
  8. @Target({ElementType.METHOD, ElementType.PARAMETER})
  9. @Retention(RetentionPolicy.RUNTIME)
  10. @Constraint(validatedBy = LocationTypeValidator.class)
  11. public @interface LocationType {
  12. String message() default "";
  13. Class<?>[] groups() default {};
  14. Class<? extends Payload>[] payload() default {};
  15.  
  16. @Test
  17. public void should_return_input_invalid_exception_for_invalid_location_type_for_get_location_endpoint() throws Exception {
  18. mockMvc.perform(get("/something/something/something")
  19. .param("locationType", "something")
  20. .header("id", "12345678"))
  21. .andExpect(status().isBadRequest());
  22.  
  23. }
  24.  
  25. @RunWith(SpringJUnit4ClassRunner.class)
  26. @SpringBootTest(classes = { something.class, something.class})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement