### Question:
ExporterFactory { public static Exporter createExporter(String exporterClassName) { Exporter result = null; try { Class<?> exporterClass = ReflectionUtil.classForName(exporterClassName); result = (Exporter)exporterClass.newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException exception) { throw new RuntimeException("An exporter of class '" + exporterClassName + "' could not be created", exception); } return result; }  static Exporter createExporter(String exporterClassName); static Exporter createExporter(ExporterType exporterType);  }### Answer:
@Test public void testCreateExporter() { try { ExporterFactory.createExporter("foobar"); Assert.fail(); } catch(Throwable t) { Assert.assertTrue(t.getMessage().contains("foobar")); } Exporter exporter = ExporterFactory.createExporter( "org.hibernate.tool.api.export.ExporterFactoryTest$TestExporter"); Assert.assertNotNull(exporter); Assert.assertTrue(exporter instanceof TestExporter); exporter = ExporterFactory.createExporter(ExporterType.JAVA); Assert.assertNotNull(exporter); Assert.assertEquals( ExporterType.JAVA.className(), exporter.getClass().getName()); }