1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 public class SimpleTests {
18     public static class TestGuardSkips extends VarHandleUnitTest {
checkGuard()19         public boolean checkGuard() {
20             return false;
21         }
22 
23         @Override
doTest()24         protected void doTest() {
25             throw new IllegalStateException("Not reachable");
26         }
27 
main(String[] args)28         public static void main(String[] args) {
29             new TestGuardSkips().run();
30         }
31     }
32 
33     public static class TestEqualsOK extends VarHandleUnitTest {
34         @Override
doTest()35         protected void doTest() {
36             assertEquals(true, true);
37         }
38     }
39 
40     public static class TestEqualsOK2 extends VarHandleUnitTest {
41         @Override
doTest()42         protected void doTest() {
43             assertEquals(true, false);
44         }
45     }
46 
47     public static class TestExceptionsFail extends VarHandleUnitTest {
48         @Override
doTest()49         protected void doTest() {
50             throw new NullPointerException();
51         }
52     }
53 
main(String[] args)54     public static void main(String[] args) {
55         new TestGuardSkips().run();
56         new TestEqualsOK().run();
57         new TestEqualsOK2().run();
58         new TestExceptionsFail().run();
59         VarHandleUnitTest.DEFAULT_COLLECTOR.printSummary();
60     }
61 }
62