File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
api/src/test/java/net/okocraft/box/api Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ package net .okocraft .box .api ;
2
+
3
+ import org .junit .jupiter .api .Assertions ;
4
+ import org .junit .jupiter .api .Test ;
5
+ import org .mockito .Mockito ;
6
+
7
+ class BoxAPITest {
8
+
9
+ @ Test
10
+ void testObtainingAPI () {
11
+ try {
12
+ // First, checking if the BoxAPI is not set.
13
+ Assertions .assertFalse (BoxAPI .isLoaded ());
14
+ Assertions .assertThrows (IllegalStateException .class , BoxAPI ::api );
15
+
16
+ // Set dummy BoxAPI
17
+ BoxProvider .API = Mockito .mock (BoxAPI .class );
18
+
19
+ // Checking if the BoxAPI can be obtained.
20
+ Assertions .assertTrue (BoxAPI .isLoaded ());
21
+ Assertions .assertDoesNotThrow (BoxAPI ::api );
22
+ Assertions .assertSame (BoxProvider .API , BoxAPI .api ());
23
+ } finally {
24
+ BoxProvider .API = null ;
25
+ }
26
+ }
27
+
28
+ }
You can’t perform that action at this time.
0 commit comments