WebActionController { @RequestMapping(value=URI_PATTERN_P_OPEN, produces="application/json", method=RequestMethod.DELETE) public Object handleDelete(HttpServletRequest req, @RequestParam String v) { return handleInternal(req, RequestMethod.DELETE, v, null); }  @RequestMapping(value=URI_PATTERN_P+"/clear", produces="application/json", method=RequestMethod.GET) void clear(); @RequestMapping(value=URI_PATTERN_P+"/loglevel", produces="application/json", method=RequestMethod.GET) Output<String> updateLogLevel(@RequestParam(value="level") String level, @RequestParam(value="package") String packageName); @RequestMapping(value=URI_PATTERN_P_OPEN, produces="application/json", method=RequestMethod.GET) Object handleGet(HttpServletRequest req, @RequestParam(required=false) String a); @RequestMapping(value=URI_PATTERN_P_OPEN, produces="application/json", method=RequestMethod.DELETE) Object handleDelete(HttpServletRequest req, @RequestParam String v); @RequestMapping(value=URI_PATTERN_P_OPEN, produces="application/json", method=RequestMethod.POST) Object handlePost(HttpServletRequest req, @RequestBody String json); @RequestMapping(value=URI_PATTERN_P_OPEN, produces="application/json", method=RequestMethod.PUT) Object handlePut(HttpServletRequest req, @RequestParam String v, @RequestBody String json); @RequestMapping(value=URI_PATTERN_P_OPEN, produces="application/json", method=RequestMethod.PATCH) Object handlePatch(HttpServletRequest req, @RequestParam String v, @RequestBody String json); @RequestMapping(value=URI_PATTERN_P+"/event/notify", produces="application/json", method=RequestMethod.POST) Object handleEventNotify(HttpServletRequest req, @RequestBody ModelEvent<String> event); @RequestMapping(value = {"/login/*"}, method = RequestMethod.GET) ResponseEntity<?> login(); static final String URI_PATTERN_P; static final String URI_PATTERN_P_OPEN; }
@SuppressWarnings("unchecked") @Test public void testHandleDelete() { final HttpServletRequest req = new MockHttpServletRequest(); final RequestMethod requestMethod = RequestMethod.DELETE; final String version = "1.0"; final String json = null; final Object obj = new Object(); Mockito.when(this.dispatcher.handle(req, json)).thenReturn(obj); final Object response = this.testee.handleDelete(req, version); Mockito.verify(this.dispatcher, Mockito.times(1)).handle(req, json); Assert.assertTrue("Expected type: " + Holder.class + " but found " + response.getClass(), response.getClass().isAssignableFrom(Holder.class)); Assert.assertEquals(obj, ((Holder<Object>) response).getState()); }