# Interfaces 101 : Testing with a Mock Interface Ep. 8

DevFeed: [Interfaces 101 : Testing with a Mock Interface Ep. 8](<https://devfeed.tech/articles/interfaces-101-testing-with-a-mock-interface-ep-8-22220.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2023/03/interfaces-101-testing-with-a-mock-interface-ep-8.html>)

Published: 2023-03-20T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [interfaces](<https://devfeed.tech/topics/interfaces.md>), [Go Language](<https://devfeed.tech/topics/go-language.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Mocking](<https://devfeed.tech/topics/mocking.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [client](<https://devfeed.tech/topics/client.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [go](<https://devfeed.tech/tags/go.md>), [golang](<https://devfeed.tech/tags/golang.md>), [health-check](<https://devfeed.tech/tags/health-check.md>), [http](<https://devfeed.tech/tags/http.md>), [http-roundtripper](<https://devfeed.tech/tags/http-roundtripper.md>), [interfaces](<https://devfeed.tech/tags/interfaces.md>), [mock-api](<https://devfeed.tech/tags/mock-api.md>), [tests](<https://devfeed.tech/tags/tests.md>), [unit-test](<https://devfeed.tech/tags/unit-test.md>), [unit-testing](<https://devfeed.tech/tags/unit-testing.md>), [video](<https://devfeed.tech/tags/video.md>)

## AI overview

This video tutorial explains how to design small, composable interfaces in Go and test an API client. It demonstrates performing HTTP requests and using a mock implementation to specify server response codes during unit testing.

## Source excerpt

Introduction In episode 7, Miki discussed design considerations to keep in mind while creating interfaces in Go with the first idea he proposed being that an interface should represent what we need from a type, and not what is stored on the type. To add some clarity to this thought, Miki explained how the io.Reader and io.Writer interfaces each require one method to be implemented although the underlying concrete type may store more information. The second idea he proposed was that interfaces should be small, with less than 6 methods, to ensure your code remains composable.