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

Method Close

mocks/sync_producer.go:150–159  ·  view source on GitHub ↗

Close corresponds with the Close method of sarama's SyncProducer implementation. By closing a mock syncproducer, you also tell it that no more SendMessage calls will follow, so it will write an error to the test state if there's any remaining expectations.

()

Source from the content-addressed store, hash-verified

148// By closing a mock syncproducer, you also tell it that no more SendMessage calls will follow,
149// so it will write an error to the test state if there's any remaining expectations.
150func (sp *SyncProducer) Close() error {
151 sp.l.Lock()
152 defer sp.l.Unlock()
153
154 if len(sp.expectations) > 0 {
155 sp.t.Errorf("Expected to exhaust all expectations, but %d are left.", len(sp.expectations))
156 }
157
158 return nil
159}
160
161////////////////////////////////////////////////
162// Setting expectations

Implementers 2

syncProducersync_producer.go
SyncProducermocks/sync_producer.go

Calls 1

ErrorfMethod · 0.65