01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.harmony.drlvm.tests.regression.h3225;
19:
20: /**
21: * The class launches methods which contain invalid <code>jsr</code> usage and
22: * should be rejected by a verifier.
23: */
24: public class NegativeJsrTest extends junit.framework.TestCase {
25: public static void main(String args[]) {
26: junit.textui.TestRunner
27: .run(org.apache.harmony.drlvm.tests.regression.h3225.NegativeJsrTest.class);
28: }
29:
30: private void checkVerifyError() {
31: final String testMethodName = Thread.currentThread()
32: .getStackTrace()[3].getMethodName();
33: assertEquals("test", testMethodName.substring(0, 4));
34:
35: final String testClassName = "org.apache.harmony.drlvm.tests.regression.h3225."
36: + testMethodName.substring(4) + "NegativeTest";
37: try {
38: Class.forName(testClassName).getConstructors();
39: } catch (VerifyError ve) {
40: return;
41: } catch (ClassNotFoundException cnfe) {
42: fail("Failed to load " + testClassName);
43: }
44: fail(testClassName + " should throw java.lang.VerifyError");
45: }
46:
47: public void testMergeExecution() {
48: checkVerifyError();
49: }
50:
51: public void testMergeEmptyStack() {
52: checkVerifyError();
53: }
54:
55: public void testMergeIntFloat() {
56: checkVerifyError();
57: }
58:
59: public void testMergeStack() {
60: checkVerifyError();
61: }
62:
63: public void testRetOrder() {
64: checkVerifyError();
65: }
66: }
|