rt/vm/src/test/java/org/apidesign/vm4brwsr/StaticUseSubTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 28 Feb 2013 07:48:54 +0100
changeset 789 bb7506513353
parent 777 8a1f840a286b
child 1787 ea12a3bb4b33
permissions -rw-r--r--
releasing the compiled code as soon as it is no longer needed to prevent OutOfMemoryError when adding more and more tests
jaroslav@775
     1
/**
jaroslav@777
     2
 * Back 2 Browser Bytecode Translator
jaroslav@777
     3
 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@775
     4
 *
jaroslav@777
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@777
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@777
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@775
     8
 *
jaroslav@777
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@777
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@777
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@777
    12
 * GNU General Public License for more details.
jaroslav@775
    13
 *
jaroslav@777
    14
 * You should have received a copy of the GNU General Public License
jaroslav@777
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@777
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@775
    17
 */
jaroslav@775
    18
package org.apidesign.vm4brwsr;
jaroslav@775
    19
jaroslav@789
    20
import org.testng.annotations.AfterClass;
jaroslav@775
    21
import org.testng.annotations.BeforeClass;
jaroslav@775
    22
import org.testng.annotations.Test;
jaroslav@775
    23
jaroslav@775
    24
/**
jaroslav@775
    25
 *
jaroslav@775
    26
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@775
    27
 */
jaroslav@775
    28
public class StaticUseSubTest {
jaroslav@775
    29
    private static TestVM code;
jaroslav@775
    30
jaroslav@775
    31
    @BeforeClass
jaroslav@775
    32
    public static void compileTheCode() throws Exception {
jaroslav@775
    33
        StringBuilder sb = new StringBuilder();
jaroslav@775
    34
        code = TestVM.compileClass(sb, "org/apidesign/vm4brwsr/StaticUseSub");
jaroslav@775
    35
    }
jaroslav@789
    36
    @AfterClass
jaroslav@789
    37
    public static void releaseTheCode() {
jaroslav@789
    38
        code = null;
jaroslav@789
    39
    }
jaroslav@775
    40
    
jaroslav@775
    41
    @Test public void getInheritedStaticField() throws Exception {
jaroslav@775
    42
        code.assertExec(
jaroslav@775
    43
            "Obtains non-null", StaticUseSub.class, 
jaroslav@775
    44
            "getNonNull__Ljava_lang_String_2",
jaroslav@775
    45
            "java.lang.Object"
jaroslav@775
    46
        );
jaroslav@775
    47
    }
jaroslav@775
    48
}