@Test(expectedExceptions = IllegalArgumentException.class) public void testNullContentLengthIllegal() { AtmosObject object = injector.getInstance(AtmosObject.Factory.class).create(null); Payload payload = Payloads.newStringPayload(""); payload.getContentMetadata().setContentLength(null); object.setPayload(payload); HttpRequest request = new HttpRequest("GET", URI.create("http://localhost")); binder.bindToRequest(request, object); }
public void testGood() { AtmosObject object = injector.getInstance(AtmosObject.Factory.class).create(null); Payload payload = Payloads.newStringPayload(""); object.setPayload(payload); object.getUserMetadata().getListableMetadata().put("apple", "bear"); object.getUserMetadata().getListableMetadata().put("sushi", "king"); HttpRequest request = new HttpRequest("GET", URI.create("http://localhost")); request = binder.bindToRequest(request, object); assertEquals(request.getFirstHeaderOrNull("x-emc-listable-meta"), "apple=bear,sushi=king"); }
static { EXPECTED = Guice.createInjector() .getInstance(AtmosObject.Factory.class) .create( ParseSystemMetadataFromHeadersTest.EXPECTED, ParseUserMetadataFromHeadersTest.EXPECTED); EXPECTED.getContentMetadata().setName("e913e09366364e9ba384b8fead643d43"); EXPECTED.setPayload(RESPONSE.getPayload()); }