// Path: src/org/github/DetectHtml.java
// public class DetectHtml
// {
// 	// adapted from post by Phil Haack and modified to match better
// 	public final static String tagStart=
// 		"\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)\\>";
// 	public final static String tagEnd=
// 		"\\</\\w+\\>";
// 	public final static String tagSelfClosing=
// 		"\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)/\\>";
// 	public final static String htmlEntity=
// 		"&[a-zA-Z][a-zA-Z0-9]+;";
// 	public final static Pattern htmlPattern=Pattern.compile(
// 	  "("+tagStart+".*"+tagEnd+")|("+tagSelfClosing+")|("+htmlEntity+")",
// 	  Pattern.DOTALL
// 	);
// 
// 	/**
// 	 * Will return true if s contains HTML markup tags or entities.
// 	 *
// 	 * @param s String to test
// 	 * @return true if string contains HTML
// 	 */
// 	public static boolean isHtml(String s) {
// 		boolean ret=false;
// 		if (s != null) {
// 			ret=htmlPattern.matcher(s).find();
// 		}
// 		return ret;
// 	}
// 
// }


import static org.junit.Assert.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import org.github.DetectHtml;
import org.junit.Test;



public class DetectHtmlTest {

	@Test
	public void test() {

		boolean reportToConsole=false;
		boolean fileNotFound=false;

		// iterate through HTML files
		File[] htmlFiles = new File("testdata/html/").listFiles();
		if (reportToConsole)
			System.out.println("Testing HTML files\n-----");
		for (File htmlFile : htmlFiles) {
			fileNotFound=false;
			try {
				String htmlContent = new Scanner(htmlFile).useDelimiter("\\Z").next();
// Path: src/org/github/DetectHtml.java
// public class DetectHtml
// {
// 	// adapted from post by Phil Haack and modified to match better
// 	public final static String tagStart=
// 		"\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)\\>";
// 	public final static String tagEnd=
// 		"\\</\\w+\\>";
// 	public final static String tagSelfClosing=
// 		"\\<\\w+((\\s+\\w+(\\s*\\=\\s*(?:\".*?\"|'.*?'|[^'\"\\>\\s]+))?)+\\s*|\\s*)/\\>";
// 	public final static String htmlEntity=
// 		"&[a-zA-Z][a-zA-Z0-9]+;";
// 	public final static Pattern htmlPattern=Pattern.compile(
// 	  "("+tagStart+".*"+tagEnd+")|("+tagSelfClosing+")|("+htmlEntity+")",
// 	  Pattern.DOTALL
// 	);
// 
// 	/**
// 	 * Will return true if s contains HTML markup tags or entities.
// 	 *
// 	 * @param s String to test
// 	 * @return true if string contains HTML
// 	 */
// 	public static boolean isHtml(String s) {
// 		boolean ret=false;
// 		if (s != null) {
// 			ret=htmlPattern.matcher(s).find();
// 		}
// 		return ret;
// 	}
// 
// }


// Path: test/DetectHtmlTest.java
import static org.junit.Assert.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import org.github.DetectHtml;
import org.junit.Test;




public class DetectHtmlTest {

	@Test
	public void test() {

		boolean reportToConsole=false;
		boolean fileNotFound=false;

		// iterate through HTML files
		File[] htmlFiles = new File("testdata/html/").listFiles();
		if (reportToConsole)
			System.out.println("Testing HTML files\n-----");
		for (File htmlFile : htmlFiles) {
			fileNotFound=false;
			try {
				String htmlContent = new Scanner(htmlFile).useDelimiter("\\Z").next();
				boolean isHtml=DetectHtml.isHtml(htmlContent);