/** * simple case. * * @throws Exception if failed */ @Test public void of() throws Exception { ClassDescription desc = ClassDescription.of(String.class); assertThat(desc.getClassName(), is("java.lang.String")); assertThat(desc.getBinaryName(), is("java.lang.String")); assertThat(desc.getInternalName(), is("java/lang/String")); assertThat(desc.getSimpleName(), is("String")); assertThat(desc.resolve(getClass().getClassLoader()), is((Object) String.class)); }
/** * inner class. * * @throws Exception if failed */ @Test public void of_inner() throws Exception { ClassDescription desc = ClassDescription.of(Thread.State.class); assertThat(desc.getClassName(), is("java.lang.Thread.State")); assertThat(desc.getBinaryName(), is("java.lang.Thread$State")); assertThat(desc.getInternalName(), is("java/lang/Thread$State")); assertThat(desc.getSimpleName(), is("State")); assertThat(desc.resolve(getClass().getClassLoader()), is((Object) Thread.State.class)); }
/** simple case. */ @Test public void simple() { ClassDescription desc = new ClassDescription("com.example.Testing"); assertThat(desc.getTypeKind(), is(TypeKind.CLASS)); assertThat(desc.getClassName(), is("com.example.Testing")); assertThat(desc.getBinaryName(), is("com.example.Testing")); assertThat(desc.getInternalName(), is("com/example/Testing")); assertThat(desc.getSimpleName(), is("Testing")); }
/** * pass array type. * * @throws Exception if failed */ @Test(expected = IllegalArgumentException.class) public void of_array() throws Exception { ClassDescription.of(String[].class); }
/** * pass primitive type. * * @throws Exception if failed */ @Test(expected = IllegalArgumentException.class) public void of_primitive() throws Exception { ClassDescription.of(int.class); }