use of org.apache.cayenne.reflect.ClassDescriptorFactory in project cayenne by apache.
the class EntityResolverClassDescriptorIT method testServerDescriptorFactory.
@Test
public void testServerDescriptorFactory() {
EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
resolver.getClassDescriptorMap().clearDescriptors();
ClassDescriptor descriptor = mock(ClassDescriptor.class);
ClassDescriptorFactory factory = mock(ClassDescriptorFactory.class);
when(factory.getDescriptor("MtTable1")).thenReturn(descriptor);
resolver.getClassDescriptorMap().addFactory(factory);
try {
ClassDescriptor resolved = resolver.getClassDescriptor("MtTable1");
assertNotNull(resolved);
resolved = ((LazyClassDescriptorDecorator) resolved).getDescriptor();
assertSame(descriptor, resolved);
} finally {
resolver.getClassDescriptorMap().removeFactory(factory);
}
}
Aggregations