View Javadoc

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  package org.apache.commons.classscan.bcel;
15  
16  import static org.junit.Assert.assertEquals;
17  import static org.junit.Assert.assertNull;
18  
19  import java.net.URISyntaxException;
20  
21  import org.apache.commons.classscan.MetaClassLoader;
22  import org.apache.commons.classscan.MetaRegistry;
23  import org.apache.commons.classscan.model.MetaClass;
24  import org.junit.Before;
25  import org.junit.Test;
26  
27  public class PrimitiveClassTest {
28  
29      MetaClassLoader classLoader;
30      MetaClass byteClass;
31      
32      @Before
33      public void loadLocation() throws URISyntaxException {
34          classLoader = MetaRegistry.DEFAULT_REGISTRY.getMetaClassLoader(Byte.TYPE.getClassLoader());
35          byteClass = classLoader.findMetaClass(Byte.TYPE.getCanonicalName());
36      }
37  
38      @Test
39      public void testGetClassLocation() throws URISyntaxException {
40          assertNull(byteClass.getClassLocation());
41      }
42  
43      @Test
44      public void testGetCanonicalName() {
45          assertEquals(Byte.TYPE.getCanonicalName(), byteClass.getName());
46      }
47  
48      @Test
49      public void testGetParent() throws URISyntaxException {
50          assertNull(byteClass.getParent());
51      }
52  
53      @Test
54      public void testGetInterfaces() {
55          assertEquals(0, byteClass.getInterfaces().size());
56      }
57  
58      @Test
59      public void testGetAnnotations() {
60          assertEquals(0, byteClass.getAnnotations().size());
61      }
62  
63      @Test
64      public void testGetMethods() {
65          assertEquals(0, byteClass.getMethods().size());
66      }
67  
68      @Test
69      public void testGetFields() {
70          assertEquals(0, byteClass.getFields().size());
71      }
72  }