jaroslav@1201: package ${package}; jaroslav@1201: jaroslav@1201: import org.apidesign.bck2brwsr.vmtest.Compare; jaroslav@1201: import org.apidesign.bck2brwsr.vmtest.VMTest; jaroslav@1201: import org.testng.annotations.Factory; jaroslav@1201: jaroslav@1201: /** Bck2brwsr cares about compatibility with real Java. Whatever API is jaroslav@1201: * supported by bck2brwsr, it needs to behave the same way as when running jaroslav@1201: * in HotSpot VM. jaroslav@1201: *

jaroslav@1201: * There can be bugs, however. To help us fix them, we kindly ask you to jaroslav@1201: * write an "inconsistency" test. A test that compares behavior of the API jaroslav@1201: * between real VM and bck2brwsr VM. This class is skeleton of such test. jaroslav@1201: * jaroslav@1201: * @author Jaroslav Tulach jaroslav@1201: */ jaroslav@1201: public class InconsistencyTest { jaroslav@1201: /** A method to demonstrate inconsistency between bck2brwsr and HotSpot. jaroslav@1201: * Make calls to an API that behaves strangely, return some result at jaroslav@1201: * the end. No need to use any assert. jaroslav@1201: * jaroslav@1201: * @return value to compare between HotSpot and bck2brwsr jaroslav@1201: */ jaroslav@1201: @Compare jaroslav@1201: public int checkStringHashCode() throws Exception { jaroslav@1201: return "Is string hashCode the same?".hashCode(); jaroslav@1201: } jaroslav@1201: jaroslav@1201: /** Factory method that creates a three tests for each method annotated with jaroslav@1201: * {@link org.apidesign.bck2brwsr.vmtest.Compare}. One executes the code in jaroslav@1201: * HotSpot, one in Rhino and the last one compares the results. jaroslav@1201: * jaroslav@1201: * @see org.apidesign.bck2brwsr.vmtest.VMTest jaroslav@1201: */ jaroslav@1201: @Factory jaroslav@1201: public static Object[] create() { jaroslav@1201: return VMTest.create(InconsistencyTest.class); jaroslav@1201: } jaroslav@1201: jaroslav@1201: }