@Test (expectedExceptions = ModuleCreationException.class) public void shouldFailToCreateInstanceWithPublicArgsConstructor() { Class<? extends Module> moduleClass = TestModule3.class; guiceModuleCreator.createInstance(moduleClass); fail(); }
public <T extends Module> T createInstance(Class<T> clazz) { try { Constructor<T> constructor = getConstructor(clazz); return constructor.newInstance(); } catch (InstantiationException e) { throw new ModuleCreationException(e); } catch (IllegalAccessException e) { throw new ModuleCreationException(e); } catch (NoSuchMethodException e) { throw new ModuleCreationException(e); } catch (InvocationTargetException e) { throw new ModuleCreationException(e); } }
GuiceModuleCreator { public <T extends Module> T createInstance(Class<T> clazz) { try { Constructor<T> constructor = getConstructor(clazz); return constructor.newInstance(); } catch (InstantiationException e) { throw new ModuleCreationException(e); } catch (IllegalAccessException e) { throw new ModuleCreationException(e); } catch (NoSuchMethodException e) { throw new ModuleCreationException(e); } catch (InvocationTargetException e) { throw new ModuleCreationException(e); } } }
GuiceModuleCreator { public <T extends Module> T createInstance(Class<T> clazz) { try { Constructor<T> constructor = getConstructor(clazz); return constructor.newInstance(); } catch (InstantiationException e) { throw new ModuleCreationException(e); } catch (IllegalAccessException e) { throw new ModuleCreationException(e); } catch (NoSuchMethodException e) { throw new ModuleCreationException(e); } catch (InvocationTargetException e) { throw new ModuleCreationException(e); } }  }
GuiceModuleCreator { public <T extends Module> T createInstance(Class<T> clazz) { try { Constructor<T> constructor = getConstructor(clazz); return constructor.newInstance(); } catch (InstantiationException e) { throw new ModuleCreationException(e); } catch (IllegalAccessException e) { throw new ModuleCreationException(e); } catch (NoSuchMethodException e) { throw new ModuleCreationException(e); } catch (InvocationTargetException e) { throw new ModuleCreationException(e); } }  T createInstance(Class<T> clazz); }
GuiceModuleCreator { public <T extends Module> T createInstance(Class<T> clazz) { try { Constructor<T> constructor = getConstructor(clazz); return constructor.newInstance(); } catch (InstantiationException e) { throw new ModuleCreationException(e); } catch (IllegalAccessException e) { throw new ModuleCreationException(e); } catch (NoSuchMethodException e) { throw new ModuleCreationException(e); } catch (InvocationTargetException e) { throw new ModuleCreationException(e); } }  T createInstance(Class<T> clazz);  }