use of com.adaptris.core.http.server.MetadataStatusProvider in project interlok by adaptris.
the class MetadataStatusProviderTest method testGetStatus_MissingMetadata_WithText.
@Test
public void testGetStatus_MissingMetadata_WithText() {
MetadataStatusProvider prov = new MetadataStatusProvider("httpStatus", "httpStatusText");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
msg.addMetadata("httpStatusText", "Really Not OK");
assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, prov.getStatus(msg).getCode());
assertNotSame("Internal Server Error", prov.getStatus(msg).getText());
assertEquals("Really Not OK", prov.getStatus(msg).getText());
}
use of com.adaptris.core.http.server.MetadataStatusProvider in project interlok by adaptris.
the class MetadataStatusProviderTest method testGetStatus_WithMetadata.
@Test
public void testGetStatus_WithMetadata() {
MetadataStatusProvider prov = new MetadataStatusProvider("httpStatus");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
msg.addMetadata("httpStatus", "200");
assertEquals(HttpURLConnection.HTTP_OK, prov.getStatus(msg).getCode());
assertEquals("OK", prov.getStatus(msg).getText());
}
use of com.adaptris.core.http.server.MetadataStatusProvider in project interlok by adaptris.
the class MetadataStatusProviderTest method testGetStatus_MissingMetadata.
@Test
public void testGetStatus_MissingMetadata() {
MetadataStatusProvider prov = new MetadataStatusProvider("httpStatus");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, prov.getStatus(msg).getCode());
assertEquals("Internal Server Error", prov.getStatus(msg).getText());
}
use of com.adaptris.core.http.server.MetadataStatusProvider in project interlok by adaptris.
the class MetadataStatusProviderTest method testGetStatus_WithText.
@Test
public void testGetStatus_WithText() {
MetadataStatusProvider prov = new MetadataStatusProvider("httpStatus", "httpStatusText");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
msg.addMetadata("httpStatus", "200");
msg.addMetadata("httpStatusText", "Really Not OK");
assertEquals(HttpURLConnection.HTTP_OK, prov.getStatus(msg).getCode());
assertNotSame("OK", prov.getStatus(msg).getText());
assertEquals("Really Not OK", prov.getStatus(msg).getText());
}
Aggregations