/*
 * Created on 20-Apr-2005
*/
import junit.framework.TestCase;
import edu.uiuc.webcoord.*;

import java.io.*;

/**
 * @author Brian Schoudel
 */
public class TestHTMLValidate extends TestCase {

	public static void main(String[] args) {
	}

	/*
	 * @see TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
	}

	/*
	 * @see TestCase#tearDown()
	 */
	protected void tearDown() throws Exception {
		super.tearDown();
	}

	/**
	 * Constructor for TestFetchHTML.
	 * @param arg0
	 */
	public TestHTMLValidate(String arg0) {
		super(arg0);
	}

	/*
	 * @Check that output file is created from validator
	 */
	public void testHTMLValidateOutFileCreated() {
		
		FileOutputStream fout;		

		try
		{
		    // Open an output stream
		    fout = new FileOutputStream ("JUnitTest.html");

		    // Print a line of text
		    new PrintStream(fout).println ("<html><body>Testing JUnit</body></html>");

		    // Close our output stream
		    fout.close();		
		}
		// Catches any error conditions
		catch (IOException e)
		{
			System.err.println ("Unable to write to file");
			System.exit(-1);
		}

		
		String inFile = "JUnitTest.html";
		String outFile = "JUnitTestOut.html";
		String errFile = "HTMLValidateErrorJUnit.log";
		HTMLValidate hv = new HTMLValidate(inFile, outFile, errFile, false);
		hv.run();

		File f = new File("JUnitTestOut.html");
		assertTrue(f.exists() );
	}
	
	/*
	 * @Check that error file is created from validator
	 */
	public void testHTMLValidateErrFileCreated() {

		File f = new File("HTMLValidateErrorJUnit.log");
		assertTrue(f.exists() );
	}
}
