@Test public void testSetClassName() throws Exception { Intent intent = new Intent(); Class<? extends IntentTest> thisClass = getClass(); intent.setClassName("package.name", thisClass.getName()); assertSame(thisClass.getName(), intent.getComponent().getClassName()); assertEquals("package.name", intent.getComponent().getPackageName()); ShadowIntent si = shadowOf(intent); assertSame(si.getIntentClass(), thisClass); }
public static Class<?> malform(Class<?> type) throws Exception { ClassReader classReader = new ClassReader(type.getName()); ClassWriter classWriter = new ClassWriter(classReader, 0); classReader.accept(new SignatureMalformer(classWriter), 0); ClassLoader classLoader = new ByteArrayClassLoader( null, Collections.singletonMap(type.getName(), classWriter.toByteArray()), null, ByteArrayClassLoader.PersistenceHandler.MANIFEST, PackageDefinitionStrategy.NoOp.INSTANCE); return classLoader.loadClass(type.getName()); }
@Test public void testSourceName() throws Exception { for (Class<?> type : standardTypes) { if (type.isArray()) { assertThat(describe(type).getActualName(), is(type.getComponentType().getName() + "[]")); } else { assertThat(describe(type).getActualName(), is(type.getName())); } } }
@Test public void testName() throws Exception { for (Class<?> type : TYPES) { assertThat(describe(type).getName(), is(type.getName())); } }