I'm trying to figure out whether it's an API design flaw, it is actually OK, or the SRP is being violated.
I'm having 2 public methods initialize()
and onListRefresh()
. Both of them call the same private method updateList()
. The only difference between both of them is that initialize()
also check for a null argument to throw an exception.
The issue is that in order to test both public methods, I practically have to copy paste the same mocks, stub, expectations and assertions, which are all for what happens on the private method; And it feels wrong. So which one is it:
- Is there a flaw in the public API design?
- It's alright, that's how it's supposed to be.
- You're violating SRP by using
initialize()
to do both checking for an argument AND callingupdateList()
Aucun commentaire:
Enregistrer un commentaire