riferrei / srclient

Golang Client for Schema Registry
Apache License 2.0
236 stars 70 forks source link

Mocking #3

Closed maarek closed 4 years ago

maarek commented 4 years ago

The SchemaRegistryClient should either implement an interface so that its functionality can be mocked or it should have the option to accept an http client so the underlying http client can be mocked.

Or Both? This would be an alternative to testing using net/http/httptest. Thoughts?

riferrei commented 4 years ago

I think both ideas area great. I went ahead and defined a new interface called ISchemaRegistryClient to abstract away the functions provided by SchemaRegistryClient. That should help in allowing the code to be extended with any needed mock. However, I didn't created a overloaded version of the CreateSchemaRegistryClient to accept an http client. Would you like to provide a PR for this?

Thanks,

-- @riferrei