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

Function TestConsumerWithExpectationsOnUnconsumedPartition

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

Source from the content-addressed store, hash-verified

194}
195
196func TestConsumerWithExpectationsOnUnconsumedPartition(t *testing.T) {
197 trm := newTestReporterMock()
198 consumer := NewConsumer(trm, NewTestConfig())
199 consumer.ExpectConsumePartition("test", 0, sarama.OffsetOldest).YieldMessage(&sarama.ConsumerMessage{Value: []byte("hello world")})
200
201 if err := consumer.Close(); err != nil {
202 t.Error("No error expected on close, but found:", err)
203 }
204
205 if len(trm.errors) != 1 {
206 t.Errorf("Expected an expectation failure to be set on the error reporter.")
207 }
208}
209
210func TestConsumerWithWrongOffsetExpectation(t *testing.T) {
211 trm := newTestReporterMock()

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected