ResponseEntityBuilder { public static <T> ResponseEntity<T> created() { return created(null, false); } private  ResponseEntityBuilder(); static ResponseEntity<T> created(); static ResponseEntity<T> created(final String location); static ResponseEntity<T> created(final String location, final boolean noContent); static ResponseEntity<T> created(final boolean noContent, final String uriTemplate,
            final String... keyValues); static ResponseEntity<T> ok(); static ResponseEntity<T> ok(final T response); static ResponseEntity<Void> noContent(); static ResponseEntity<T> notFound(); static ResponseEntity<Void> unprocessable();  }
@Test public void testUpdatedWithLocation() { ResponseEntity<Object> created = ResponseEntityBuilder.created("/report/1", Boolean.TRUE); Assert.assertNotNull(created); Assert.assertNull(created.getBody()); Assert.assertEquals(created.getStatusCode(), HttpStatus.NO_CONTENT); Assert.assertNotNull(created.getHeaders()); URI location = created.getHeaders().getLocation(); Assert.assertEquals(location.getPath(), "/report/1"); }
@Test public void testCreated() { ResponseEntity<Object> created = ResponseEntityBuilder.created(); Assert.assertNotNull(created); Assert.assertNull(created.getBody()); Assert.assertEquals(created.getStatusCode(), HttpStatus.CREATED); }
@Test public void testCreatedWithLocation() { ResponseEntity<Object> created = ResponseEntityBuilder.created("/report/1", Boolean.FALSE); Assert.assertNotNull(created); Assert.assertNull(created.getBody()); Assert.assertEquals(created.getStatusCode(), HttpStatus.CREATED); Assert.assertNotNull(created.getHeaders()); URI location = created.getHeaders().getLocation(); Assert.assertEquals(location.getPath(), "/report/1"); }