use of org.hotswap.agent.plugin.jvm.AnonymousClassInfo in project HotswapAgent by HotswapProjects.
the class AnonymousClassInfosTest method testTransitionsSignatrues.
@Test
public void testTransitionsSignatrues() throws Exception {
AnonymousClassInfos stateInfo = getClassPoolInfos(AnonymousTestClass2.class);
stateInfo.mapPreviousState(getClassPoolInfos(AnonymousTestClass1.class));
Map<AnonymousClassInfo, AnonymousClassInfo> mappings = stateInfo.getCompatibleTransitions();
for (Map.Entry<AnonymousClassInfo, AnonymousClassInfo> mapping : mappings.entrySet()) {
assertNotNull("Class not mapped " + mapping.getKey(), mapping.getValue());
assertEquals(mapping.getKey().getClassName(), AnonymousTestClass1.class.getName() + "$1");
assertEquals(mapping.getValue().getClassName(), AnonymousTestClass2.class.getName() + "$1");
}
}
use of org.hotswap.agent.plugin.jvm.AnonymousClassInfo in project HotswapAgent by HotswapProjects.
the class AnonymousClassInfoTest method getAnonymousCtClassInfo.
public AnonymousClassInfo getAnonymousCtClassInfo() throws NotFoundException, ClassNotFoundException, IOException, CannotCompileException {
Class clazz = getClass().getClassLoader().loadClass(AnonymousTestClass1.class.getName() + "$1");
ClassPool classPool = new ClassPool();
classPool.appendClassPath(new LoaderClassPath(getClass().getClassLoader()));
return new AnonymousClassInfo(classPool.get(clazz.getName()));
}
use of org.hotswap.agent.plugin.jvm.AnonymousClassInfo in project HotswapAgent by HotswapProjects.
the class AnonymousClassInfosTest method testTransitionsSameClass.
@Test
public void testTransitionsSameClass() throws Exception {
AnonymousClassInfos stateInfo = getClassPoolInfos(AnonymousTestClass1.class);
stateInfo.mapPreviousState(getClassPoolInfos(AnonymousTestClass1.class));
Map<AnonymousClassInfo, AnonymousClassInfo> mappings = stateInfo.getCompatibleTransitions();
for (Map.Entry<AnonymousClassInfo, AnonymousClassInfo> mapping : mappings.entrySet()) {
assertNotNull("Class not mapped " + mapping.getKey(), mapping.getValue());
assertTrue("Class not exact match " + mapping.getKey(), mapping.getKey().matchExact(mapping.getValue()));
assertEquals(mapping.getKey().getClassName(), AnonymousTestClass1.class.getName() + "$1");
assertEquals(mapping.getValue().getClassName(), AnonymousTestClass1.class.getName() + "$1");
}
}
Aggregations