Search in sources :

Example 6 with AnonymousClassInfos

use of org.hotswap.agent.plugin.jvm.AnonymousClassInfos 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");
    }
}
Also used : AnonymousClassInfos(org.hotswap.agent.plugin.jvm.AnonymousClassInfos) AnonymousClassInfo(org.hotswap.agent.plugin.jvm.AnonymousClassInfo) Map(java.util.Map) Test(org.junit.Test)

Aggregations

AnonymousClassInfos (org.hotswap.agent.plugin.jvm.AnonymousClassInfos)6 Test (org.junit.Test)5 Map (java.util.Map)2 AnonymousClassInfo (org.hotswap.agent.plugin.jvm.AnonymousClassInfo)2 ClassPool (org.hotswap.agent.javassist.ClassPool)1 LoaderClassPath (org.hotswap.agent.javassist.LoaderClassPath)1