rt/mojo/src/main/resources/archetype-resources/src/test/java/InconsistencyTest.java
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/rt/mojo/src/main/resources/archetype-resources/src/test/java/InconsistencyTest.java Tue Apr 02 15:40:51 2013 +0200
1.3 @@ -0,0 +1,40 @@
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 + * @author Jaroslav Tulach <jtulach@netbeans.org>
1.19 + */
1.20 +public class InconsistencyTest {
1.21 + /** A method to demonstrate inconsistency between bck2brwsr and HotSpot.
1.22 + * Make calls to an API that behaves strangely, return some result at
1.23 + * the end. No need to use any <code>assert</code>.
1.24 + *
1.25 + * @return value to compare between HotSpot and bck2brwsr
1.26 + */
1.27 + @Compare
1.28 + public int checkStringHashCode() throws Exception {
1.29 + return "Is string hashCode the same?".hashCode();
1.30 + }
1.31 +
1.32 + /** Factory method that creates a three tests for each method annotated with
1.33 + * {@link org.apidesign.bck2brwsr.vmtest.Compare}. One executes the code in
1.34 + * HotSpot, one in Rhino and the last one compares the results.
1.35 + *
1.36 + * @see org.apidesign.bck2brwsr.vmtest.VMTest
1.37 + */
1.38 + @Factory
1.39 + public static Object[] create() {
1.40 + return VMTest.create(InconsistencyTest.class);
1.41 + }
1.42 +
1.43 +}