# README
sarama/mocks
The mocks
subpackage includes mock implementations that implement the interfaces of the major sarama types.
You can use them to test your sarama applications using dependency injection.
The following mock objects are available:
- Consumer, which will create PartitionConsumer mocks.
- AsyncProducer
- SyncProducer
The mocks allow you to set expectations on them. When you close the mocks, the expectations will be verified,
and the results will be reported to the *testing.T
object you provided when creating the mock.
# Functions
NewAsyncProducer instantiates a new Producer mock.
NewConsumer returns a new mock Consumer instance.
NewSyncProducer instantiates a new SyncProducer mock.
# Constants
No description provided by the author
# Structs
AsyncProducer implements sarama's Producer interface for testing purposes.
Consumer implements sarama's Consumer interface for testing purposes.
PartitionConsumer implements sarama's PartitionConsumer interface for testing purposes.
SyncProducer implements sarama's SyncProducer interface for testing purposes.
# Interfaces
ErrorReporter is a simple interface that includes the testing.T methods we use to report expectation violations when using the mock objects.
# Type aliases
ValueChecker is a function type to be set in each expectation of the producer mocks to check the value passed.