response.setContentType( "text/plain" );
//Running the given junit test class
JUnitCore jUnitCore = new JUnitCore();
//Adding a listener for the running test
TestTextRingingListener testRingingListener = new TestTextRingingListener();
jUnitCore.addListener( testRingingListener );
try {
jUnitCore.run( Class.forName( className ) );
} catch ( ClassNotFoundException e ) {
throw new ServletException( e );
}
//Setting the response
response.setStatus( testRingingListener.getStatusCode() );
Logger.info( testRingingListener.toString() );
response.getWriter().print( testRingingListener.toString() );
}