ko/archetype/src/main/resources/archetype-resources/src/test/java/InconsistencyTest.java
changeset 1574 d51a5533a2e7
parent 870 448bed1f6d5a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ko/archetype/src/main/resources/archetype-resources/src/test/java/InconsistencyTest.java	Thu May 15 11:38:27 2014 +0200
     1.3 @@ -0,0 +1,38 @@
     1.4 +package ${package};
     1.5 +
     1.6 +import org.apidesign.bck2brwsr.vmtest.Compare;
     1.7 +import org.apidesign.bck2brwsr.vmtest.VMTest;
     1.8 +import org.testng.annotations.Factory;
     1.9 +
    1.10 +/** Bck2brwsr cares about compatibility with real Java. Whatever API is
    1.11 + * supported by bck2brwsr, it needs to behave the same way as when running
    1.12 + * in HotSpot VM. 
    1.13 + * <p>
    1.14 + * There can be bugs, however. To help us fix them, we kindly ask you to 
    1.15 + * write an "inconsistency" test. A test that compares behavior of the API
    1.16 + * between real VM and bck2brwsr VM. This class is skeleton of such test.
    1.17 + */
    1.18 +public class InconsistencyTest {
    1.19 +    /** A method to demonstrate inconsistency between bck2brwsr and HotSpot.
    1.20 +     * Make calls to an API that behaves strangely, return some result at
    1.21 +     * the end. No need to use any <code>assert</code>.
    1.22 +     * 
    1.23 +     * @return value to compare between HotSpot and bck2brwsr
    1.24 +     */
    1.25 +    @Compare
    1.26 +    public int checkStringHashCode() throws Exception {
    1.27 +        return "Is string hashCode the same?".hashCode();
    1.28 +    }
    1.29 +
    1.30 +    /** Factory method that creates a three tests for each method annotated with
    1.31 +     * {@link org.apidesign.bck2brwsr.vmtest.Compare}. One executes the code in
    1.32 +     * HotSpot, one in Rhino and the last one compares the results.
    1.33 +     * 
    1.34 +     * @see org.apidesign.bck2brwsr.vmtest.VMTest
    1.35 +     */
    1.36 +    @Factory
    1.37 +    public static Object[] create() {
    1.38 +        return VMTest.create(InconsistencyTest.class);
    1.39 +    }
    1.40 +    
    1.41 +}