MCPcopy
hub / github.com/IBM/sarama / NewConsumer

Function NewConsumer

mocks/consumer.go:25–39  ·  view source on GitHub ↗

NewConsumer returns a new mock Consumer instance. The t argument should be the *testing.T instance of your test method. An error will be written to it if an expectation is violated. The config argument can be set to nil; if it is non-nil it is validated.

(t ErrorReporter, config *sarama.Config)

Source from the content-addressed store, hash-verified

23// an expectation is violated. The config argument can be set to nil; if it is
24// non-nil it is validated.
25func NewConsumer(t ErrorReporter, config *sarama.Config) *Consumer {
26 if config == nil {
27 config = sarama.NewConfig()
28 }
29 if err := config.Validate(); err != nil {
30 t.Errorf("Invalid mock configuration provided: %s", err.Error())
31 }
32
33 c := &Consumer{
34 t: t,
35 config: config,
36 partitionConsumers: make(map[string]map[int32]*PartitionConsumer),
37 }
38 return c
39}
40
41///////////////////////////////////////////////////
42// Consumer interface implementation

Calls 4

NewConfigFunction · 0.92
ValidateMethod · 0.80
ErrorfMethod · 0.65
ErrorMethod · 0.65