|
|
|
|
|
by spenczar5
223 days ago
|
|
"But accepting the full S3Client here ties UploadReport to an interface that’s too broad. A fake must implement all the methods just to satisfy it." This isn't really true. Your mock inplementation can embed the interface, but only implement the one required method. Calling the unimplemented methods will panic, but that's not unreasonable for mocks. That is: type mockS3 struct {
S3Client
}
func (m mockS3) PutObject(...) {
...
}
You don't have to implement all the other methods.Defining a zillion interfaces, all the permutations of methods in use, makes it hard to cone up with good names, and thus hard to read. |
|