Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @GetMapping(value="")
- public ResponseEntity<JsonResponse> getLocations(@RequestHeader(value="id") String id, @LocationType @RequestParam(value="locationType" ) String P_STS_AREA_TYP) {
- ...
- return new ResponseEntity<>(response,HttpStatus.OK);
- }
- @Target({ElementType.METHOD, ElementType.PARAMETER})
- @Retention(RetentionPolicy.RUNTIME)
- @Constraint(validatedBy = LocationTypeValidator.class)
- public @interface LocationType {
- String message() default "";
- Class<?>[] groups() default {};
- Class<? extends Payload>[] payload() default {};
- @Test
- public void should_return_input_invalid_exception_for_invalid_location_type_for_get_location_endpoint() throws Exception {
- mockMvc.perform(get("/something/something/something")
- .param("locationType", "something")
- .header("id", "12345678"))
- .andExpect(status().isBadRequest());
- }
- @RunWith(SpringJUnit4ClassRunner.class)
- @SpringBootTest(classes = { something.class, something.class})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement