Ejemplo n.º 1
0
 @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}]]")));
 }
Ejemplo n.º 2
0
 @Test
 public void testRequestParams_whenNoParametersAreSpecifiedForTracing_delegatesToRequest()
     throws Exception {
   assertThat(Traceables.requestParams(request).asString(), is(notNullValue(String.class)));
 }
Ejemplo n.º 3
0
 @Test
 public void testRequestParams_withParameters_whichAreNotPresentOnTheRequest() throws Exception {
   assertThat(
       Traceables.requestParams(request, "invalid1", "invalid2").asString(),
       is(equalTo("HttpServletRequest.params: [[{invalid1=null, invalid2=null}]]")));
 }
Ejemplo n.º 4
0
 @Test
 public void testRequestParams_whenRequestIsNull_shouldOutput_nullRequestString()
     throws Exception {
   assertThat(
       Traceables.requestParams(null).asString(), is(equalTo("[null - HttpServletRequest]")));
 }