ValidationApproachFactory implements TransactionSettingFactory { @Override public Optional<TransactionSetting> getTransactionSetting(String value) { try { return Optional.of(ValidationApproach.valueOf(value)); } catch (IllegalArgumentException e) { return Optional.empty(); } }  @Override String getName(); @Override Optional<TransactionSetting> getTransactionSetting(String value);  }
@Test public void testGetTransactionSetting() { ValidationApproachFactory factory = new ValidationApproachFactory(); assertThat(factory.getTransactionSetting(ValidationApproach.Auto.getValue())).isNotEmpty(); assertThat(factory.getTransactionSetting("unrecognized value")).isEmpty(); }