### Question:
DefaultEmailSenderProvider implements EmailSenderProvider { @Override public Optional<TemplatedEmailSender> lookupTemplatedEmailSenderFor(final String providerType) { assertValidProviderTypeArgument(providerType); return Optional.ofNullable(registeredTemplatedEmailSenders.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 testLookupTemplatedEmailSenderForWithIllegalArguments() { assertThatThrownBy(() -> emailSenderProvider.lookupTemplatedEmailSenderFor(null)) .isInstanceOf(IllegalArgumentException.class); assertThatThrownBy(() -> emailSenderProvider.lookupTemplatedEmailSenderFor("")) .isInstanceOf(IllegalArgumentException.class); }
@Test public void testLookupTemplatedEmailSenderForMissing() { assertThat(emailSenderProvider.lookupTemplatedEmailSenderFor(templatedEmailSenderRegistry.name() + "_test")) .isEmpty(); }
@Test public void testLookupTemplatedEmailSenderForSender() { assertThat(emailSenderProvider.lookupTemplatedEmailSenderFor(templatedEmailSenderRegistry.name())) .isPresent() .contains(templatedEmailSenderRegistry.sender()); }