rt/mojo/src/main/resources/archetype-resources/src/test/java/InconsistencyTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 26 Feb 2013 16:54:16 +0100
changeset 772 d382dacfd73f
parent 534 mojo/src/main/resources/archetype-resources/src/test/java/InconsistencyTest.java@3cefccd50bd5
permissions -rw-r--r--
Moving modules around so the runtime is under one master pom and can be built without building other modules that are in the repository
     1 package ${package};
     2 
     3 import org.apidesign.bck2brwsr.vmtest.Compare;
     4 import org.apidesign.bck2brwsr.vmtest.VMTest;
     5 import org.testng.annotations.Factory;
     6 
     7 /** Bck2brwsr cares about compatibility with real Java. Whatever API is
     8  * supported by bck2brwsr, it needs to behave the same way as when running
     9  * in HotSpot VM. 
    10  * <p>
    11  * There can be bugs, however. To help us fix them, we kindly ask you to 
    12  * write an "inconsistency" test. A test that compares behavior of the API
    13  * between real VM and bck2brwsr VM. This class is skeleton of such test.
    14  *
    15  * @author Jaroslav Tulach <jtulach@netbeans.org>
    16  */
    17 public class InconsistencyTest {
    18     /** A method to demonstrate inconsistency between bck2brwsr and HotSpot.
    19      * Make calls to an API that behaves strangely, return some result at
    20      * the end. No need to use any <code>assert</code>.
    21      * 
    22      * @return value to compare between HotSpot and bck2brwsr
    23      */
    24     @Compare
    25     public int checkStringHashCode() throws Exception {
    26         return "Is string hashCode the same?".hashCode();
    27     }
    28 
    29     /** Factory method that creates a three tests for each method annotated with
    30      * {@link org.apidesign.bck2brwsr.vmtest.Compare}. One executes the code in
    31      * HotSpot, one in Rhino and the last one compares the results.
    32      * 
    33      * @see org.apidesign.bck2brwsr.vmtest.VMTest
    34      */
    35     @Factory
    36     public static Object[] create() {
    37         return VMTest.create(InconsistencyTest.class);
    38     }
    39     
    40 }