MfaProviderBootstrap implements InitializingBean { @Override public void afterPropertiesSet() { for(MfaProvider provider : mfaProviders) { MfaProvider existing; try { existing = provisioning.retrieveByName(provider.getName(), "uaa"); } catch (EmptyResultDataAccessException x){ provisioning.create(provider, "uaa"); continue; } provider.setId(existing.getId()); provider.setCreated(existing.getCreated()); provider.setLastModified(new Date(System.currentTimeMillis())); provisioning.update(provider, "uaa"); } } MfaProviderBootstrap(MfaProviderProvisioning provisioning); @Override void afterPropertiesSet(); List<MfaProvider> getMfaProviders(); void setMfaProviders(Map<String, Map<String, Object>> mfaProviderYaml);  }
@Test void afterPropertiesSet() { bootstrap.setMfaProviders(sampleData); bootstrap.afterPropertiesSet(); verify(provisioning).create(expectedGoogleProviders.get(0), "uaa"); verify(provisioning).create(expectedGoogleProviders.get(1), "uaa"); }