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

Function TestConsumerWithoutExpectationsOnPartition

mocks/consumer_test.go:178–194  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

176}
177
178func TestConsumerWithoutExpectationsOnPartition(t *testing.T) {
179 trm := newTestReporterMock()
180 consumer := NewConsumer(trm, NewTestConfig())
181
182 _, err := consumer.ConsumePartition("test", 1, sarama.OffsetOldest)
183 if !errors.Is(err, errOutOfExpectations) {
184 t.Error("Expected ConsumePartition to return errOutOfExpectations")
185 }
186
187 if err := consumer.Close(); err != nil {
188 t.Error("No error expected on close, but found:", err)
189 }
190
191 if len(trm.errors) != 1 {
192 t.Errorf("Expected an expectation failure to be set on the error reporter.")
193 }
194}
195
196func TestConsumerWithExpectationsOnUnconsumedPartition(t *testing.T) {
197 trm := newTestReporterMock()

Callers

nothing calls this directly

Calls 8

ConsumePartitionMethod · 0.95
CloseMethod · 0.95
newTestReporterMockFunction · 0.85
IsMethod · 0.80
NewConsumerFunction · 0.70
NewTestConfigFunction · 0.70
ErrorMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected