(t *testing.T)
| 156 | } |
| 157 | |
| 158 | func TestSyncProducerWithTooManyExpectations(t *testing.T) { |
| 159 | trm := newTestReporterMock() |
| 160 | |
| 161 | sp := NewSyncProducer(trm, nil). |
| 162 | ExpectSendMessageAndSucceed(). |
| 163 | ExpectSendMessageAndFail(sarama.ErrOutOfBrokers) |
| 164 | |
| 165 | msg := &sarama.ProducerMessage{Topic: "test", Value: sarama.StringEncoder("test")} |
| 166 | if _, _, err := sp.SendMessage(msg); err != nil { |
| 167 | t.Error("No error expected on first SendMessage call", err) |
| 168 | } |
| 169 | |
| 170 | if err := sp.Close(); err != nil { |
| 171 | t.Error(err) |
| 172 | } |
| 173 | |
| 174 | if len(trm.errors) != 1 { |
| 175 | t.Error("Expected to report an error") |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | func TestSyncProducerWithTooFewExpectations(t *testing.T) { |
| 180 | trm := newTestReporterMock() |
nothing calls this directly
no test coverage detected