import org.aspectj.testing.Tester; public class Asserts { public static void main(String[] args) { Asserts.class.getClassLoader().setClassAssertionStatus("TestAsserts", true); TestAsserts.main(args); } } class TestAsserts { public static void main(String[] args) { //C c = new C(); //C.m(9); int x = 0; assert x < 2; assert x <10 : 3; boolean pass = false; try { assert x > 2; } catch (AssertionError e) { pass = true; } finally { Tester.check(pass, "no expected assertion-1"); } pass = false; try { assert x >10 : 3; } catch (AssertionError e) { pass = true; } finally { Tester.check(pass, "no expected assertion-2"); } } static class C { static void m(int i ) { assert i < 10; } } } AspectJ5_Development A seamless aspect-oriented extension to the Java programming language: https://github.com/eclipse-aspectj/aspectjwww-data
summaryrefslogtreecommitdiffstats
path: root/tests/pureJava/TryWorksLikeEnvironment.java
blob: c166f84c355d1ce671b612a653c94a28d15f1c99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.io.*;

public class TryWorksLikeEnvironment {
    static int i;
    public static void main(String[] args) {
	try {
	    foo();
	    try {
		i++;
	    } finally {
		i++;
	    }
	} catch (FileNotFoundException e) {
	}
    }
    static void foo() throws FileNotFoundException {}
}