use of org.springframework.integration.core.MessageSource in project spring-integration by spring-projects.
the class MockIntegration method mockMessageSource.
/**
* Build a mock for the {@link MessageSource} based on the provided messages.
* The returned instance is ordinary Mockito mock that is capable of
* recording interactions with it and further verification.
* @param message the first message to return by mocked {@link MessageSource}
* @param messages the next messages to return by mocked {@link MessageSource}
* @return the mocked {@link MessageSource}
* @see Mockito#mock(Class)
*/
@SuppressWarnings("rawtypes")
public static MessageSource<?> mockMessageSource(Message<?> message, Message<?>... messages) {
MessageSource messageSource = Mockito.mock(MessageSource.class);
BDDMockito.given(messageSource.receive()).willReturn(message, messages);
return messageSource;
}
Aggregations