Test RuntimeDelegatingTypeHandler access of module class from module
@@ -171,6 +171,15 @@ public void testCannotAccessModuleClassFromEngineWithoutClassLoader() {
@Test
public void testAccessApiClassFromModule() {
+ testCanAccessClassFromModule(apiClass, apiClassHandlerMock);
+ }
+
+ @Test
+ public void testAccessModuleClassFromModule() {
+ testCanAccessClassFromModule(moduleClass, moduleClassHandlerMock);
+ }
+
+ private void testCanAccessClassFromModule(Class<?> testClass, TypeHandler testClassHandlerMock) {
TypeHandlerFactoryContext context = new TypeHandlerFactoryContext(typeSerializationLibrary,
moduleClass);
@@ -179,7 +188,7 @@ public void testAccessApiClassFromModule() {
PersistedData persistedModuleClassInstance = new PersistedMap(
ImmutableMap.of(
RuntimeDelegatingTypeHandler.TYPE_FIELD,
- new PersistedString(apiClass.getName()),
+ new PersistedString(testClass.getName()),
RuntimeDelegatingTypeHandler.VALUE_FIELD,
new PersistedMap(ImmutableMap.of())
)
@@ -188,7 +197,7 @@ public void testAccessApiClassFromModule() {
assertTrue(typeHandler.deserialize(persistedModuleClassInstance).isPresent());
verify(baseTypeHandlerMock, times(0)).deserialize(any());
- verify(apiClassHandlerMock, times(1)).deserialize(any());
+ verify(testClassHandlerMock, times(1)).deserialize(any());
}
@Test
