use of org.apache.hadoop.http.HttpServer2.QuotingInputFilter.RequestQuoter in project hadoop by apache.
the class TestHttpServer method testRequestQuoterWithNotNull.
@Test
public void testRequestQuoterWithNotNull() throws Exception {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
String[] values = new String[] { "abc", "def" };
Mockito.doReturn(values).when(request).getParameterValues("dummy");
RequestQuoter requestQuoter = new RequestQuoter(request);
String[] parameterValues = requestQuoter.getParameterValues("dummy");
Assert.assertTrue("It should return Parameter Values", Arrays.equals(values, parameterValues));
}
use of org.apache.hadoop.http.HttpServer2.QuotingInputFilter.RequestQuoter in project hadoop by apache.
the class TestHttpServer method testRequestQuoterWithNull.
@Test
public void testRequestQuoterWithNull() throws Exception {
HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
Mockito.doReturn(null).when(request).getParameterValues("dummy");
RequestQuoter requestQuoter = new RequestQuoter(request);
String[] parameterValues = requestQuoter.getParameterValues("dummy");
Assert.assertNull("It should return null " + "when there are no values for the parameter", parameterValues);
}
Aggregations