PreDeletionHookLoaderImpl implements PreDeletionHookLoader { @Override public PreDeletionHook createHook(PreDeletionHookConfiguration configuration) throws ClassNotFoundException { ClassName hookClass = new ClassName(configuration.getClazz()); LOGGER.info("Loading user registered mailbox message deletionHook {}", hookClass); return genericLoader.instantiate(hookClass); } @Inject  PreDeletionHookLoaderImpl(GuiceGenericLoader guiceGenericLoader); @Override PreDeletionHook createHook(PreDeletionHookConfiguration configuration);  }
@Test void createHookShouldThrowWhenClassNotFound() { assertThatThrownBy(() -> testee.createHook(PreDeletionHookConfiguration.forClass("invalid"))) .isInstanceOf(ClassNotFoundException.class); }
@Test void createHookShouldReturnAHookOfCreatedClass() throws Exception { assertThat(testee.createHook(PreDeletionHookConfiguration.forClass(NoopPreDeletionHook.class.getName()))) .isInstanceOf(NoopPreDeletionHook.class); }