@Test public void shouldUpdateRecord() throws Exception { RecordPayload recordPayload = RecordPayload.instanceOf(10); when(mockService.get(argThat(isString(TEST_ID)))).thenReturn(Record.instanceOf(10)); when(mockService.update(argThat(isRecord(TEST_ID, 10)))).thenReturn(Record.instanceOf(10)); Response response = recordResource.updateRecord(TEST_ID, recordPayload); assertThat(response.getStatus(), is(HttpStatus.NOT_MODIFIED.value())); }
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { System.out.println( "CachingInterceptor.preHandle() - " + request.getRequestURI() + "-" + request.getMethod()); if (isResourceCached(request.getRequestURI() + "-" + request.getMethod())) { response.setStatus(HttpStatus.NOT_MODIFIED.value()); return false; } return true; }