-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
Description
Description
This library is difficult to test because instead of returning pointers to structs, the sdk returns structs as values forcing the consumer to cast it to a pointer in order to call the necessary methods on the receiver (as the receiver is a pointer). The difficulty comes in when one wants to mock these calls out for testing purpose in their own application as a value struct can not be cast to an interface, only pointers. I wonder if its possible to add additional constructor methods that return the pointer. Thoughts?
Benefits
Easier testability from the consumers perscpective.
Detail
No response
Examples
Example:
func (o *OptimizelyClient) CreateUserContextP(userID string, attributes map[string]interface{}) *OptimizelyUserContext {
return newOptimizelyUserContextP(o, userID, attributes, nil)
}
Risks/Downsides
No response