### Question:
DefaultEmailSenderProvider implements EmailSenderProvider { @Override public Optional<SimpleEmailSender> lookupSimpleEmailSenderFor(final String providerType) { assertValidProviderTypeArgument(providerType); return Optional.ofNullable(registeredSimpleEmailSenders.get(providerType)); } DefaultEmailSenderProvider(final List<SimpleEmailSenderRegistry> simpleEmailSenderRegistries,
                               final List<TemplatedEmailSenderRegistry> templatedEmailSenderRegistries); @Override Optional<SimpleEmailSender> lookupSimpleEmailSenderFor(final String providerType); @Override Optional<TemplatedEmailSender> lookupTemplatedEmailSenderFor(final String providerType);  }### Answer:
@Test public void testLookupSimpleEmailSenderForWithIllegalArguments() { assertThatThrownBy(() -> emailSenderProvider.lookupSimpleEmailSenderFor(null)) .isInstanceOf(IllegalArgumentException.class); assertThatThrownBy(() -> emailSenderProvider.lookupSimpleEmailSenderFor("")) .isInstanceOf(IllegalArgumentException.class); }
@Test public void testLookupSimpleEmailSenderMissing() { assertThat(emailSenderProvider.lookupSimpleEmailSenderFor(simpleEmailSenderRegistry.name() + "_test")) .isEmpty(); }
@Test public void testLookupSimpleEmailSenderPresent() { assertThat(emailSenderProvider.lookupSimpleEmailSenderFor(simpleEmailSenderRegistry.name())) .isPresent() .contains(simpleEmailSenderRegistry.sender()); }