summaryrefslogtreecommitdiffstats
path: root/tests/029-assert/src/Main.java
blob: 3b1f8da4c2bd70f9eecb75e35795864b4b5e7732 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright 2007 The Android Open Source Project

/**
 * Test Java language asserts.
 */
public class Main {
    public static void main(String[] args) {
        assert true;
        try {
            assert false;
            System.out.println("GLITCH: didn't assert (is '-ea' set?)");
        } catch (AssertionError ae) {
            System.out.println("caught expected assert exception");
        }

        // exercise this code path
        ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
    }
}