When a Go interface has many methods, it may be beneficial to _____ it into smaller interfaces for easier mocking.

  • Group
  • Split
  • Combine
  • Expand
When a Go interface becomes large and has many methods, it's often beneficial to split it into smaller interfaces for easier mocking and testing. This practice aligns with the SOLID principles, particularly the "Interface Segregation Principle" (ISP), which recommends that you should have many client-specific interfaces rather than a single, large, general-purpose one. Smaller interfaces make it easier to create focused mocks and test specific interactions.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *