### Question:
SerializedFilesMimeMessageFactory extends AbstractIteratorMimeMessageFactory { @Override public Iterator<MimeMessage> createMessage(Object batchIdObject, Map<String, Object> parameters) throws MessagingException { String batchId = getTypedSource(batchIdObject, String.class); SerializedFilesMimeMessageIterator iterator = new SerializedFilesMimeMessageIterator(batchId, parameters, this.componentManagerProvider.get()); return iterator; }  @Override Iterator<MimeMessage> createMessage(Object batchIdObject, Map<String, Object> parameters);  }### Answer:
@Test public void createMessageWhenNoExecution() throws Exception { Provider<ComponentManager> componentManagerProvider = this.mocker.registerMockComponent( new DefaultParameterizedType(null, Provider.class, ComponentManager.class), "context"); when(componentManagerProvider.get()).thenReturn(this.mocker); try { this.mocker.getComponentUnderTest().createMessage("batchId", null); fail("Should have thrown an exception"); } catch (MessagingException expected) { assertEquals("Failed to find an Environment Component", expected.getMessage()); } }