Package com.blogspot.radialmind

Source Code of com.blogspot.radialmind.BaseTestCase

/**
* Copyright 2007 Gerard Toonstra
*
* Licensed under the terms of the Apache Software License v2
*
* This file is part of the XSS Protect library
*/

package com.blogspot.radialmind;

import java.io.StringReader;
import java.io.StringWriter;

import junit.framework.TestCase;

import com.blogspot.radialmind.html.HTMLParser;
import com.blogspot.radialmind.html.HandlingException;
import com.blogspot.radialmind.xss.XSSFilter;

// Verified vulnerability in :
//     Firefox 2.0    not vulnerable
//
// Needs checking in IE6.0

public abstract class BaseTestCase extends TestCase {
  protected void testExecute( String html, String result ) {
    StringReader reader = new StringReader( html );
    StringWriter writer = new StringWriter();
   
    try {
      HTMLParser.process( reader, writer, new XSSFilter(), true );
      String buffer = new String( writer.toString() );
      System.out.println( buffer );
      assertEquals( result, buffer );
    } catch (HandlingException e) {
      e.printStackTrace();
      fail( e.getMessage() );
    }
  }
}
TOP

Related Classes of com.blogspot.radialmind.BaseTestCase

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.