Debian Codegraph @

project/jpype_java/test/org/jpype/pkg/JPypePackageNGTest.java

raw symbols SCIP
1 /* ****************************************************************************
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5
6 http://www.apache.org/licenses/LICENSE-2.0
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 See NOTICE file for details.
15 **************************************************************************** */
16 package org.jpype.pkg;
17
18 import java.net.URI;
19 import java.nio.file.Path;
20 import java.util.Arrays;
21 import java.util.Map;
22 import static org.testng.Assert.*;
23 import org.testng.annotations.Test;
24
25 /**
26 *
27 * @author nelson85
28 */
29 public class JPypePackageNGTest
30 {
31
32 public JPypePackageNGTest()
33 {
34 }
35
36 @Test
37 public void testGetPackage()
38 {
39 assertTrue(JPypePackageManager.isPackage("java.lang"));
40 JPypePackage pkg = new JPypePackage("java.lang");
41 for (Map.Entry<String, URI> e : pkg.contents.entrySet())
42 {
43 Path p = JPypePackageManager.getPath(e.getValue());
44 JPypePackage.isPublic(p);
45 }
46 }
47
48 @Test
49 public void testBase()
50 {
51 assertTrue(JPypePackageManager.isPackage("java"));
52 JPypePackage pkg = new JPypePackage("java");
53 for (Map.Entry<String, URI> e : pkg.contents.entrySet())
54 {
55 System.out.println(e.getKey());
56 }
57 }
58
59 @Test
60 public void testOrg()
61 {
62 assertTrue(JPypePackageManager.isPackage("org"));
63 JPypePackage pkg = new JPypePackage("org");
64 for (Map.Entry<String, URI> e : pkg.contents.entrySet())
65 {
66 System.out.println(e.getKey());
67 }
68 }
69
70 /**
71 * Test of getObject method, of class JPypePackage.
72 */
73 @Test
74 public void testGetObject()
75 {
76 System.out.println("getObject");
77 JPypePackage instance = new JPypePackage("java.lang");
78 Object expResult = Object.class;
79 Object result = instance.getObject("Object");
80 assertEquals(result, expResult);
81 }
82
83 /**
84 * Test of getContents method, of class JPypePackage.
85 */
86 @Test
87 public void testGetContents()
88 {
89 System.out.println("getContents");
90 JPypePackage instance = new JPypePackage("java.lang");
91 String[] expResult = new String[]
92 {
93 "Enum", "ClassValue", "String"
94 };
95 String[] result = Arrays.copyOfRange(instance.getContents(), 0, 3);
96 assertEquals(result, expResult);
97 }
98
99 }