HttpWebService extends ServletBase { protected String getDetailsParameter( final HttpServletRequest request ) { String details = request.getParameter( "details" ); if ( null != details ) { return details; } String payload; try { payload = getPayloadAsString( request ); } catch ( IOException e ) { if ( HttpWebService.logger.isErrorEnabled() ) { HttpWebService.logger.error( e ); } return null; } if ( ( null != payload ) && ( payload.length() > 0 ) ) { Map parameters = getParameterMapFromPayload( payload ); Object obj = parameters.get( "details" ); if ( null != obj ) { return obj.toString(); } } return null; } HttpWebService(); @Override Log getLogger(); String getPayloadAsString( final HttpServletRequest request ); void doGetFixMe( final HttpServletRequest request, final HttpServletResponse response ); @Override void doGet( final HttpServletRequest request, final HttpServletResponse response );  }
@Test public void testGetDetailsParameter_fromRequestParam() throws Exception { when( request.getParameter( "details" ) ).thenReturn( "minutia" ); assertEquals( "minutia", httpWebService.getDetailsParameter( request ) ); }
@Test public void testGetDetailsParameter() throws Exception { payload = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http: HttpWebService service = spy( httpWebService ); doReturn( payload ).when( service ).getPayloadAsString( request ); assertEquals( "minutia", service.getDetailsParameter( request ) ); }