JobErrorHandlerFactory { public static Optional<JobErrorHandler> createHandler(final String type) { if (Strings.isNullOrEmpty(type)) { return newHandlerInstance(DEFAULT_HANDLER); } return newHandlerInstance(type); }  static Optional<JobErrorHandler> createHandler(final String type);  }
@Test public void assertGetDefaultHandler() { assertThat(JobErrorHandlerFactory.createHandler("").orElse(null), instanceOf(LogJobErrorHandler.class)); }
@Test(expected = JobConfigurationException.class) public void assertGetInvalidHandler() { JobErrorHandlerFactory.createHandler("INVALID").orElseThrow(() -> new JobConfigurationException("")); }
@Test public void assertGetHandler() { assertThat(JobErrorHandlerFactory.createHandler("THROW").orElse(null), instanceOf(ThrowJobErrorHandler.class)); }