ResponseImpl extends Response { @Override public StatusType getStatusInfo() { final Status statusInstance = Status.fromStatusCode(status); if (statusInstance != null) { return statusInstance; } return new StatusType() { @Override public int getStatusCode() { return status; } @Override public Status.Family getFamily() { return Status.Family.familyOf(status); } @Override public String getReasonPhrase() { return "Unknown"; } }; } protected  ResponseImpl(int status, Object entity, Annotation[] entityAnnotations, MultivaluedMap<String, Object> headers); @Override Object getEntity(); Annotation[] getEntityAnnotations(); @Override T readEntity(Class<T> entityType); @SuppressWarnings("unchecked") @Override T readEntity(GenericType<T> entityType); @Override T readEntity(Class<T> entityType, Annotation[] annotations); @SuppressWarnings("unchecked") @Override T readEntity(GenericType<T> entityType, Annotation[] annotations); @Override boolean hasEntity(); @Override boolean bufferEntity(); @Override void close(); boolean isClosed(); @Override MediaType getMediaType(); @Override Locale getLanguage(); @Override int getLength(); @Override Set<String> getAllowedMethods(); @Override Map<String, NewCookie> getCookies(); @Override EntityTag getEntityTag(); @Override Date getDate(); @Override Date getLastModified(); @Override URI getLocation(); @Override Set<Link> getLinks(); @Override boolean hasLink(String relation); @Override Link getLink(String relation); @Override Link.Builder getLinkBuilder(String relation); @Override MultivaluedMap<String, Object> getMetadata(); @Override MultivaluedMap<String, String> getStringHeaders(); @Override String getHeaderString(String name); @Override int getStatus(); @Override StatusType getStatusInfo(); @Override String toString();  }
@Test public void getsStatusInfoForKnownStatus() throws Exception { ResponseImpl response = new ResponseImpl(200, "foo", null, null); assertEquals(OK, response.getStatusInfo()); }
@Test public void getsUnknownStatusInfoForUnknownStatus() throws Exception { ResponseImpl response = new ResponseImpl(0, "foo", null, null); Response.StatusType statusInfo = response.getStatusInfo(); assertEquals(0, statusInfo.getStatusCode()); assertEquals(OTHER, statusInfo.getFamily()); assertEquals("Unknown", statusInfo.getReasonPhrase()); }