Skip to content

Not sure how to mock a Trait with a new with parameters #405

Answered by asomers
stefanhp asked this question in Questions
Discussion options

You must be logged in to vote

Since your trait has a new method, Mockall doesn't generate the usual one. Instead, new works like a normal method and you must make an expectation for it. If you want to create a new mock object with no expectations, you'll have to use MyTrait:::default().

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@stefanhp
Comment options

@asomers
Comment options

@stefanhp
Comment options

Answer selected by stefanhp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants