/** * Default constructor. */ private HttpServletRequestImpl() { Statistics.incrementRequestHandled(); postParameters = new HashMap<>(); getParameters = new HashMap<>(); uploadedFiles = new HashSet<>(); attributes = new HashMap<>(); }
@Test public void shouldIncrementAllCountersAndResetThem() { assertThat(Statistics.getError404s(), is(equalTo(0l))); assertThat(Statistics.getError500s(), is(equalTo(0l))); assertThat(Statistics.getRequestsHandled(), is(equalTo(0l))); Statistics.incrementError404(); assertThat(Statistics.getError404s(), is(equalTo(1l))); Statistics.incrementError500(); assertThat(Statistics.getError500s(), is(equalTo(1l))); Statistics.incrementRequestHandled(); assertThat(Statistics.getRequestsHandled(), is(equalTo(1l))); Statistics.incrementError404(); assertThat(Statistics.getError404s(), is(equalTo(2l))); Statistics.incrementError500(); assertThat(Statistics.getError500s(), is(equalTo(2l))); Statistics.incrementRequestHandled(); assertThat(Statistics.getRequestsHandled(), is(equalTo(2l))); Statistics.reset(); assertThat(Statistics.getError404s(), is(equalTo(0l))); assertThat(Statistics.getError500s(), is(equalTo(0l))); assertThat(Statistics.getRequestsHandled(), is(equalTo(0l))); }