@Test public void testLoadExternalClassShouldLoadFromExternalClassInitializerFirst() { given(externalClassInitializer.loadExternalClass(EXTERNAL_CLASS_NAME, CLASS_PATH, INTERFACE_TO_CAST)).willReturn(new Object()); Object result = underTest.loadExternalClass(EXTERNAL_CLASS_NAME, CLASS_PATH, INTERFACE_TO_CAST); assertNotNull(result); verify(externalJarClassInitializer, never()).loadExternalClass(EXTERNAL_CLASS_NAME, CLASS_PATH, INTERFACE_TO_CAST); }
public <T> T loadExternalClass(final String externalClassName, final String classPath, final Class<T> interfaceToCast) { T result; try { result = externalClassInitializer.loadExternalClass(externalClassName, classPath, interfaceToCast); } catch (DescriptorValidationFailedException dvfe) { logger.info("Couldn't initialize external class: '{}'", dvfe.getMessage()); String jarFolderPath = stubResourcePathProvider.getJarPathAsString(); result = externalJarClassInitializer.loadExternalClass(externalClassName, jarFolderPath, interfaceToCast); } return result; }
ExternalInitializer { public <T> T loadExternalClass(final String externalClassName, final String classPath, final Class<T> interfaceToCast) { T result; try { result = externalClassInitializer.loadExternalClass(externalClassName, classPath, interfaceToCast); } catch (DescriptorValidationFailedException dvfe) { logger.info("Couldn't initialize external class: '{}'", dvfe.getMessage()); String jarFolderPath = stubResourcePathProvider.getJarPathAsString(); result = externalJarClassInitializer.loadExternalClass(externalClassName, jarFolderPath, interfaceToCast); } return result; } }
ExternalInitializer { public <T> T loadExternalClass(final String externalClassName, final String classPath, final Class<T> interfaceToCast) { T result; try { result = externalClassInitializer.loadExternalClass(externalClassName, classPath, interfaceToCast); } catch (DescriptorValidationFailedException dvfe) { logger.info("Couldn't initialize external class: '{}'", dvfe.getMessage()); String jarFolderPath = stubResourcePathProvider.getJarPathAsString(); result = externalJarClassInitializer.loadExternalClass(externalClassName, jarFolderPath, interfaceToCast); } return result; }  }
ExternalInitializer { public <T> T loadExternalClass(final String externalClassName, final String classPath, final Class<T> interfaceToCast) { T result; try { result = externalClassInitializer.loadExternalClass(externalClassName, classPath, interfaceToCast); } catch (DescriptorValidationFailedException dvfe) { logger.info("Couldn't initialize external class: '{}'", dvfe.getMessage()); String jarFolderPath = stubResourcePathProvider.getJarPathAsString(); result = externalJarClassInitializer.loadExternalClass(externalClassName, jarFolderPath, interfaceToCast); } return result; }  T loadExternalClass(final String externalClassName, final String classPath, final Class<T> interfaceToCast); }
ExternalInitializer { public <T> T loadExternalClass(final String externalClassName, final String classPath, final Class<T> interfaceToCast) { T result; try { result = externalClassInitializer.loadExternalClass(externalClassName, classPath, interfaceToCast); } catch (DescriptorValidationFailedException dvfe) { logger.info("Couldn't initialize external class: '{}'", dvfe.getMessage()); String jarFolderPath = stubResourcePathProvider.getJarPathAsString(); result = externalJarClassInitializer.loadExternalClass(externalClassName, jarFolderPath, interfaceToCast); } return result; }  T loadExternalClass(final String externalClassName, final String classPath, final Class<T> interfaceToCast);  }