Search in sources :

Example 6 with MessageSource

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;
}
Also used : MessageSource(org.springframework.integration.core.MessageSource)

Aggregations

MessageSource (org.springframework.integration.core.MessageSource)6 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 Advice (org.aopalliance.aop.Advice)2 AbstractMessageSourceAdvice (org.springframework.integration.aop.AbstractMessageSourceAdvice)2 CompoundTriggerAdvice (org.springframework.integration.aop.CompoundTriggerAdvice)2 SimpleActiveIdleMessageSourceAdvice (org.springframework.integration.aop.SimpleActiveIdleMessageSourceAdvice)2 PollSkipAdvice (org.springframework.integration.scheduling.PollSkipAdvice)2 SimplePollSkipStrategy (org.springframework.integration.scheduling.SimplePollSkipStrategy)2 NamedComponent (org.springframework.integration.support.context.NamedComponent)2 OnlyOnceTrigger (org.springframework.integration.test.util.OnlyOnceTrigger)2 CompoundTrigger (org.springframework.integration.util.CompoundTrigger)2 DynamicPeriodicTrigger (org.springframework.integration.util.DynamicPeriodicTrigger)2 Trigger (org.springframework.scheduling.Trigger)2 TriggerContext (org.springframework.scheduling.TriggerContext)2 PeriodicTrigger (org.springframework.scheduling.support.PeriodicTrigger)2 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1