// Path: src/main/java/jp/gr/java_conf/daisy/ajax_mutator/util/StringToAst.java
// public static FunctionCall parseAsFunctionCall(String javaScriptSnippet) {
//     return parseAsType(FunctionCall.class, javaScriptSnippet);
// }


import jp.gr.java_conf.daisy.ajax_mutator.detector.EventAttacherDetector;
import jp.gr.java_conf.daisy.ajax_mutator.mutatable.*;
import jp.gr.java_conf.daisy.ajax_mutator.mutatable.Request.ResponseType;
import org.junit.Test;
import static jp.gr.java_conf.daisy.ajax_mutator.util.StringToAst.parseAsFunctionCall;
import static org.junit.Assert.*;
        assertEquals(Request.RequestMethod.GET, result.getRequestMethod());
        assertTrue(result.getSuccessHanlder() != null);
        assertTrue(result.getFailureHandler() == null);

        data = "{type: 'POST', dataType: 'html', success: func1, error: func2}";
        result = detector.detect(parseAsFunctionCall("$.ajax('fugafuga.php', "
                + data + ");"));
        assertTrue(result != null);
        assertEquals("'fugafuga.php'", result.getUrl().toSource());
        assertEquals(ResponseType.HTML, result.getResponseType());
        assertEquals("func1", result.getSuccessHanlder().toSource());
        assertEquals(Request.RequestMethod.POST, result.getRequestMethod());
        assertEquals("func2", result.getFailureHandler().toSource());
    }

    @Test
    public void testJQueryAttributeModificationDetector() {
        JQueryAttributeModificationDetector detector = new JQueryAttributeModificationDetector();
        AttributeModification result = detector.detect(parseAsFunctionCall(
                "$(this).attr('disabled', true)"));
        assertTrue(result != null);
        assertEquals("$(this)", result.getTargetDom().toSource());
        assertEquals("'disabled'", result.getTargetAttribute().toSource());
        assertEquals("true", result.getAttributeValue().toSource());
    }

    @Test
    public void testJQueryCloningDetector() {
        JQueryCloneDetector detector = new JQueryCloneDetector();
        DOMCloning result = detector.detect(parseAsFunctionCall(
// Path: src/main/java/jp/gr/java_conf/daisy/ajax_mutator/util/StringToAst.java
// public static FunctionCall parseAsFunctionCall(String javaScriptSnippet) {
//     return parseAsType(FunctionCall.class, javaScriptSnippet);
// }


// Path: src/test/java/jp/gr/java_conf/daisy/ajax_mutator/detector/jquery/JQueryDetectorTest.java
import jp.gr.java_conf.daisy.ajax_mutator.detector.EventAttacherDetector;
import jp.gr.java_conf.daisy.ajax_mutator.mutatable.*;
import jp.gr.java_conf.daisy.ajax_mutator.mutatable.Request.ResponseType;
import org.junit.Test;
import static jp.gr.java_conf.daisy.ajax_mutator.util.StringToAst.parseAsFunctionCall;
import static org.junit.Assert.*;

        assertEquals(Request.RequestMethod.GET, result.getRequestMethod());
        assertTrue(result.getSuccessHanlder() != null);
        assertTrue(result.getFailureHandler() == null);

        data = "{type: 'POST', dataType: 'html', success: func1, error: func2}";
        result = detector.detect(parseAsFunctionCall("$.ajax('fugafuga.php', "
                + data + ");"));
        assertTrue(result != null);
        assertEquals("'fugafuga.php'", result.getUrl().toSource());
        assertEquals(ResponseType.HTML, result.getResponseType());
        assertEquals("func1", result.getSuccessHanlder().toSource());
        assertEquals(Request.RequestMethod.POST, result.getRequestMethod());
        assertEquals("func2", result.getFailureHandler().toSource());
    }

    @Test
    public void testJQueryAttributeModificationDetector() {
        JQueryAttributeModificationDetector detector = new JQueryAttributeModificationDetector();
        AttributeModification result = detector.detect(parseAsFunctionCall(
                "$(this).attr('disabled', true)"));
        assertTrue(result != null);
        assertEquals("$(this)", result.getTargetDom().toSource());
        assertEquals("'disabled'", result.getTargetAttribute().toSource());
        assertEquals("true", result.getAttributeValue().toSource());
    }

    @Test
    public void testJQueryCloningDetector() {
        JQueryCloneDetector detector = new JQueryCloneDetector();
        DOMCloning result = detector.detect(parseAsFunctionCall(
                "$('.hello').clone()"));