@Override
  public String getContextPath() {
    return CONTEXT_PATH;
  }
@Test
  public void getContextPath() throws Exception {

    GetPropertiesServlet servlet = new GetPropertiesServlet();
    servlet.setJettyMode( true );
    HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
    HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
    StringWriter out = new StringWriter();
    PrintWriter printWriter = new PrintWriter( out );

    when( mockHttpServletRequest.getContextPath() ).thenReturn( GetPropertiesServlet.CONTEXT_PATH );
    when( mockHttpServletRequest.getParameter( "xml" ) ).thenReturn( "Y" );
    when( mockHttpServletResponse.getWriter() ).thenReturn( printWriter );

    when( mockHttpServletResponse.getOutputStream() ).thenReturn( new ServletOutputStream() {
      private ByteArrayOutputStream baos = new ByteArrayOutputStream();

      @Override public void write( int b ) throws IOException {
        baos.write( b );
      }

      public String toString() {
        return baos.toString();
      }
    } );

    servlet.doGet( mockHttpServletRequest, mockHttpServletResponse );
    //check that response is not contains sample text
    Assert.assertFalse( mockHttpServletResponse.getOutputStream().toString()
      .startsWith( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" ) );
  }