tim-group / java-statsd-client

a java statsd client library
Other
275 stars 139 forks source link

using NoOpStatsdClient for mocks #9

Closed kiro closed 10 years ago

kiro commented 11 years ago

Hi, it will be nice if the NoOpStatsDClient is not final so it's methods can be overridden for mocks. Or if it supports counters for requests so it can be used in testing to verify that it's actually been called.

scarytom commented 10 years ago

I'm very sorry for not commenting on this request sooner.

Arguably, you shouldn't ever mock something you don't own (see http://www.mockobjects.com/ or http://www.markhneedham.com/blog/2009/12/13/tdd-only-mock-types-you-own/ or countless others), but, leaving that topic aside for now, I do provide a StatsDClient interface that you can mock.

I'm not making NoOpStatsDClient non-final, as it is not designed to be extensible.

michaelsembwever commented 10 years ago

+1 for leaving NoOpStatsDClient final.