コード例 #1
0
 /**
  * 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));
 }
コード例 #2
0
 /**
  * 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));
 }
コード例 #3
0
 /** 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"));
 }
コード例 #4
0
 /**
  * pass array type.
  *
  * @throws Exception if failed
  */
 @Test(expected = IllegalArgumentException.class)
 public void of_array() throws Exception {
   ClassDescription.of(String[].class);
 }
コード例 #5
0
 /**
  * pass primitive type.
  *
  * @throws Exception if failed
  */
 @Test(expected = IllegalArgumentException.class)
 public void of_primitive() throws Exception {
   ClassDescription.of(int.class);
 }