// Path: src/main/java/codemining/languagetools/ParseType.java
// public enum ParseType {
// 	COMPILATION_UNIT, CLASS_BODY, METHOD, STATEMENTS, EXPRESSION
// }


import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.eclipse.wst.jsdt.core.dom.ASTNode;
import org.junit.Before;
import org.junit.Test;
import codemining.languagetools.ParseType;
/**
 * 
 */
package codemining.js.codeutils;





/**
 * @author Miltos Allamanis <m.allamanis@ed.ac.uk>
 * 
 */
// FIXME Javascript AST parser is quite buggy: For SampleJavascript the === is
// printed as + and for SampleJavascript2 it prints a random semicolon at line 7
// Is this just a buggy toString method issue? Tests commented out until fixed.
public class JavascriptASTExtractorTest {

	String classContent;
	String methodContent;

	@Before
	public void setUp() throws IOException {
		classContent = FileUtils.readFileToString(new File(
				JavascriptASTExtractorTest.class.getClassLoader()
						.getResource("SampleJavascript2.txt").getFile()));

		methodContent = FileUtils.readFileToString(new File(
				JavascriptASTExtractorTest.class.getClassLoader()
						.getResource("SampleJavascript.txt").getFile()));
	}

	/**
	 * Test method for
	 * {@link codemining.java.codeutils.JavaASTExtractor#getBestEffortAst(java.lang.String)}
	 * .
	 * 
	 * @throws IOException
	 */
	@Test
	public void testGetASTString() {
		final JavascriptASTExtractor ex = new JavascriptASTExtractor(false);
		assertTrue(classContent.length() > 0);
		final ASTNode classCU = ex.getASTNode(classContent,
// Path: src/main/java/codemining/languagetools/ParseType.java
// public enum ParseType {
// 	COMPILATION_UNIT, CLASS_BODY, METHOD, STATEMENTS, EXPRESSION
// }


// Path: src/test/java/codemining/js/codeutils/JavascriptASTExtractorTest.java
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.eclipse.wst.jsdt.core.dom.ASTNode;
import org.junit.Before;
import org.junit.Test;
import codemining.languagetools.ParseType;

/**
 * 
 */
package codemining.js.codeutils;





/**
 * @author Miltos Allamanis <m.allamanis@ed.ac.uk>
 * 
 */
// FIXME Javascript AST parser is quite buggy: For SampleJavascript the === is
// printed as + and for SampleJavascript2 it prints a random semicolon at line 7
// Is this just a buggy toString method issue? Tests commented out until fixed.
public class JavascriptASTExtractorTest {

	String classContent;
	String methodContent;

	@Before
	public void setUp() throws IOException {
		classContent = FileUtils.readFileToString(new File(
				JavascriptASTExtractorTest.class.getClassLoader()
						.getResource("SampleJavascript2.txt").getFile()));

		methodContent = FileUtils.readFileToString(new File(
				JavascriptASTExtractorTest.class.getClassLoader()
						.getResource("SampleJavascript.txt").getFile()));
	}

	/**
	 * Test method for
	 * {@link codemining.java.codeutils.JavaASTExtractor#getBestEffortAst(java.lang.String)}
	 * .
	 * 
	 * @throws IOException
	 */
	@Test
	public void testGetASTString() {
		final JavascriptASTExtractor ex = new JavascriptASTExtractor(false);
		assertTrue(classContent.length() > 0);
		final ASTNode classCU = ex.getASTNode(classContent,
				ParseType.COMPILATION_UNIT);