ResponseStatisticsImpl implements ResponseStatistics { @Override public Map<Integer, Long> getResponseCodes() { return responseCodes; } private  ResponseStatisticsImpl(final Integer lastResponseCode, final Map<Integer, Long> responseCodes); @Override Integer getLastResponseCode(); @Override Map<Integer, Long> getResponseCodes(); @Override ResponseStatistics snapshot();  }
@Test public void testImmutability() { ResponseStatisticsImpl.Builder builder = new ResponseStatisticsImpl.Builder(); builder.addResponseCode(100); exception.expect(UnsupportedOperationException.class); builder.build().getResponseCodes().put(100, 2L); }