ide/editor/src/test/java/org/apidesign/bck2brwsr/ide/editor/JSNI2JavaScriptBodyTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 13 Feb 2013 16:52:33 +0100
branchide
changeset 722 70b229246864
parent 717 58ce0cd13d26
permissions -rw-r--r--
Updating the expected output to recent changes in the B2BNI
jaroslav@716
     1
/**
jaroslav@716
     2
 * Back 2 Browser Bytecode Translator
jaroslav@716
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@716
     4
 *
jaroslav@716
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@716
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@716
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@716
     8
 *
jaroslav@716
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@716
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@716
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@716
    12
 * GNU General Public License for more details.
jaroslav@716
    13
 *
jaroslav@716
    14
 * You should have received a copy of the GNU General Public License
jaroslav@716
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@716
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@716
    17
 */
jaroslav@716
    18
package org.apidesign.bck2brwsr.ide.editor;
jaroslav@716
    19
jaroslav@716
    20
import org.apidesign.bck2brwsr.core.JavaScriptBody;
jaroslav@716
    21
import org.netbeans.modules.java.hints.test.api.HintTest;
jaroslav@716
    22
import org.openide.filesystems.FileUtil;
jaroslav@717
    23
import org.testng.annotations.Test;
jaroslav@716
    24
jaroslav@716
    25
public class JSNI2JavaScriptBodyTest {
jaroslav@716
    26
jaroslav@716
    27
    @Test
jaroslav@716
    28
    public void testFixWorking() throws Exception {
jaroslav@716
    29
        HintTest.create()
jaroslav@716
    30
                .input("package test;\n" +
jaroslav@716
    31
                       "public class Test {\n" +
jaroslav@716
    32
                       "    public native void run(int a) /*-{ this.a = a; }-*/;\n" +
jaroslav@716
    33
                       "}\n")
jaroslav@716
    34
                .classpath(FileUtil.getArchiveRoot(JavaScriptBody.class.getProtectionDomain().getCodeSource().getLocation()))
jaroslav@716
    35
                .run(JSNI2JavaScriptBody.class)
jaroslav@716
    36
                .findWarning("2:23-2:26:verifier:" + Bundle.ERR_JSNI2JavaScriptBody())
jaroslav@716
    37
                .applyFix()
jaroslav@716
    38
                .assertCompilable()
jaroslav@716
    39
                .assertOutput("package test;\n" +
jaroslav@716
    40
                              "import org.apidesign.bck2brwsr.core.JavaScriptBody;\n" +
jaroslav@716
    41
                              "public class Test {\n" +
jaroslav@722
    42
                              "    @JavaScriptBody(args = {\"a\"}, body = \" this.a = a; \")\n" +
jaroslav@716
    43
                              "    public native void run(int a);\n" +
jaroslav@716
    44
                              "}\n");
jaroslav@716
    45
    }
jaroslav@716
    46
}