1 /*
2  * Copyright (C) 2023 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 package libcore.jdk.internal.access;
17 
18 import libcore.test.annotation.NonCts;
19 import libcore.test.reasons.NonCtsReasons;
20 
21 import org.junit.Assert;
22 import org.junit.Test;
23 import org.junit.runner.RunWith;
24 import org.junit.runners.JUnit4;
25 
26 import jdk.internal.access.SharedSecrets;
27 
28 @NonCts(bug = 287231726, reason = NonCtsReasons.INTERNAL_APIS)
29 @RunWith(JUnit4.class)
30 public class SharedSecretsTest {
31 
32     /**
33      * This test doesn't completely rule out race conditions such as http://b/80495283 (between
34      * FileDescriptor and UnixChannelFactory): Even if this test passes by the time it runs, the
35      * condition that it enforces may not have been true earlier in the runtime start.
36      */
37     @Test
testGetJavaIOFileDescriptorAccess_notNull()38     public void testGetJavaIOFileDescriptorAccess_notNull() {
39         Assert.assertNotNull("SharedSecrets.getJavaIOFileDescriptorAccess can't be null",
40                 SharedSecrets.getJavaIOFileDescriptorAccess());
41     }
42 }
43