Skip to content

Latest commit

 

History

History
24 lines (14 loc) · 1.61 KB

README.md

File metadata and controls

24 lines (14 loc) · 1.61 KB

gomock-example

Test Status Coverage Status Go Report Card

This repository contains some examples showing a progressive way to implement mocks and use gomock framework to apply and autogen mocks.

finalspace0

Is the first example and is the simplest implementation, it is only a code separation for request and parse response.

finalspace1

Is the second example and, in comparation with the previous example, adds the dependency injection to specify the http client and api endpoint through parameters ensuring a more flexible use.

finalspace2

Is the third example and it is equals to the previous implementation, in this example was incresed the tests and created a transport http mock to be possible uses the original http client and mock the response.

finalspace3

Is the fourth example and was added a http client interface to replace the default http client struct and use a different function, the Do, to make the request, turning possible to use mockgen to generate a http client mock used to test the finalspace client.