public class StreamFactoryMock<T>
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
StreamFactory |
build()
End method that will actually create the mocked
TypedStreamFactory |
static <T> StreamFactoryMock<T> |
newFactory(java.lang.Class<T> factoryOfType)
Start the creation of a new
StreamFactoryMock. |
StreamFactoryMock<T> |
withIdDiscoverAnother(StreamId<T> id,
StreamId<T> idToDiscover)
|
StreamFactoryMock<T> |
withIdInvoke(StreamId<T> id,
java.util.function.BiFunction<StreamId<T>,DiscoveryService,org.reactivestreams.Publisher<T>> bifunction)
When the factory is asked to create
id, it will invoke the specified BiFunction. |
StreamFactoryMock<T> |
withIdProvideStreamWithValue(StreamId<T> id,
T value)
When the factory is asked to create
id, a ReactiveStream that contains the value will be
provided. |
public static <T> StreamFactoryMock<T> newFactory(java.lang.Class<T> factoryOfType)
StreamFactoryMock.factoryOfType - the type of the values that this factory will deal with. This is only useful for the
compiler to be able to infer the correct type of the StreamFactoryMockpublic StreamFactoryMock<T> withIdDiscoverAnother(StreamId<T> id, StreamId<T> idToDiscover)
id - the id that triggers the discoveryidToDiscover - the id that will be discoveredpublic StreamFactoryMock<T> withIdProvideStreamWithValue(StreamId<T> id, T value)
id, a ReactiveStream that contains the value will be
provided.id - the id that triggers the stream creationvalue - the value that the created stream will containpublic StreamFactoryMock<T> withIdInvoke(StreamId<T> id, java.util.function.BiFunction<StreamId<T>,DiscoveryService,org.reactivestreams.Publisher<T>> bifunction)
id, it will invoke the specified BiFunction. This gives the
power to provide custom behavior in tests, the BiFunction will receive the StreamId and a
DiscoveryService and must produce a ReactiveStream.id - the id that triggers the bifuction invocationbifunction - the function that will be invokedpublic StreamFactory build()
TypedStreamFactory