launcher/src/test/java/org/apidesign/bck2brwsr/dew/CompileTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 16 Jan 2013 12:28:56 +0100
branchdew
changeset 468 a7ff47e054f3
parent 464 9823859d253a
child 469 c6e6782950b8
permissions -rw-r--r--
Fixing license
jaroslav@468
     1
/**
jaroslav@468
     2
 * Back 2 Browser Bytecode Translator
jaroslav@468
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@468
     4
 *
jaroslav@468
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@468
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@468
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@468
     8
 *
jaroslav@468
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@468
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@468
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@468
    12
 * GNU General Public License for more details.
jaroslav@468
    13
 *
jaroslav@468
    14
 * You should have received a copy of the GNU General Public License
jaroslav@468
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@468
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@468
    17
 */
jaroslav@462
    18
package org.apidesign.bck2brwsr.dew;
jaroslav@462
    19
jaroslav@462
    20
import java.io.IOException;
jaroslav@462
    21
import static org.testng.Assert.*;
jaroslav@462
    22
import org.testng.annotations.Test;
jaroslav@462
    23
jaroslav@462
    24
/**
jaroslav@462
    25
 *
jaroslav@462
    26
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@462
    27
 */
jaroslav@462
    28
public class CompileTest  {
jaroslav@462
    29
    @Test public void testCompile() throws IOException {
jaroslav@462
    30
        String html = "<html><body>"
jaroslav@462
    31
                + " <button id='btn'>Hello!</button>"
jaroslav@462
    32
                + "</body></html>";
jaroslav@462
    33
        String java = "package x.y.z;"
jaroslav@463
    34
                + "import org.apidesign.bck2brwsr.htmlpage.api.*;"
jaroslav@463
    35
            + "@Page(xhtml=\"index.html\", className=\"Index\")"
jaroslav@463
    36
            + "class X { "
jaroslav@463
    37
            + "   @OnClick(id=\"btn\") static void clcs() {}"
jaroslav@463
    38
            + "}";
jaroslav@464
    39
        Compile result = Compile.create(html, java);
jaroslav@462
    40
jaroslav@462
    41
        assertNotNull(result.get("x/y/z/X.class"), "Class X is compiled: " + result);
jaroslav@463
    42
        assertNotNull(result.get("x/y/z/Index.class"), "Class Index is compiled: " + result);
jaroslav@462
    43
    }
jaroslav@462
    44
}