MultiStatusResponse { public int getStatus(String resId) { Integer status = responses.get(resId); if (status == null) { throw new NoSuchElementException("Unknown resource ID: " + resId + "; not contained in this multi-status response."); } return status; } MultiStatusResponse(Map<String, Integer> responses); static MultiStatusResponse fromJson(ObjectMapper mapper, InputStream stream); Map<String, Integer> getResponses(); int responseCount(); boolean isAllSuccess(); boolean hasResourceId(String resId); int getStatus(String resId); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testGetStatus() throws IOException { MultiStatusResponse response = fromJson(FILE_FAILURE_RESPONSE); assertThat(response.getStatus("res-success")).isEqualTo(200); assertThat(response.getStatus("res-err-2")).isEqualTo(500); }
@Test(expected = NoSuchElementException.class) public void testGetStatusUnknownResourceId() { MultiStatusResponse response = new MultiStatusResponse(Collections.singletonMap("foo", 42)); response.getStatus("nonExistingResource"); }