mockall
mockall copied to clipboard
Struct with different traits that has identically named methods
Let say I want to mock a struct like this:
mock!(
Foo {}
impl A for Foo {
fn new(&self) -> A;
}
impl B for Foo {
fn new(&self) -> B;
}
);
Then I am getting an error saying that expect_new() is already defined. I would strongly prefer the created method to be named something like expect_A_new(), you get the point.
This name collision is a well known problem, and there's no setting in Mockall that can fix it for you. You'll have to manually mock one of those methods.