@Test public void testRequestParams_withParameters() throws Exception { when(request.getParameter("valid1")).thenReturn("validvalue1"); assertThat( Traceables.requestParams(request, "valid1", "invalid2").asString(), is(equalTo("HttpServletRequest.params: [[{valid1=validvalue1, invalid2=null}]]"))); }
@Test public void testRequestParams_whenNoParametersAreSpecifiedForTracing_delegatesToRequest() throws Exception { assertThat(Traceables.requestParams(request).asString(), is(notNullValue(String.class))); }
@Test public void testRequestParams_withParameters_whichAreNotPresentOnTheRequest() throws Exception { assertThat( Traceables.requestParams(request, "invalid1", "invalid2").asString(), is(equalTo("HttpServletRequest.params: [[{invalid1=null, invalid2=null}]]"))); }
@Test public void testRequestParams_whenRequestIsNull_shouldOutput_nullRequestString() throws Exception { assertThat( Traceables.requestParams(null).asString(), is(equalTo("[null - HttpServletRequest]"))); }