ResponseEntity provides static "notFound()" convenience method as well

Issue: SPR-12070
This commit is contained in:
Juergen Hoeller
2014-08-07 22:28:35 +02:00
parent 3227569a38
commit 5862ddc869
2 changed files with 31 additions and 1 deletions

View File

@@ -20,9 +20,13 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import static org.junit.Assert.*;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* @author Arjen Poutsma
*/
public class ResponseEntityTests {
@Test
@@ -97,6 +101,15 @@ public class ResponseEntityTests {
assertNull(responseEntity.getBody());
}
@Test
public void notFound() throws URISyntaxException {
ResponseEntity<Void> responseEntity = ResponseEntity.notFound().build();
assertNotNull(responseEntity);
assertEquals(HttpStatus.NOT_FOUND, responseEntity.getStatusCode());
assertNull(responseEntity.getBody());
}
@Test
public void headers() throws URISyntaxException {
String eTag = "\"foo\"";