You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be extremely helpful to have the ability to "name" mock instances so that they would show up with that name in toString calls (or at least in the error messages for validations). It is not always possible to only have a single mock instance of a given type so having the ability to quickly see what happened in the error output would save a bit of time.
testClass.someMethod(arg1);
testClass.someMethod(arg2);
new FullVerifications({{
arg1.expectedMethod(); times = 1;
arg2.expectedMethod(); times = 1;
}});
}
`
[I am totally failing at the markdown, no idea why it won't format correctly]
If the validation fails because of an unexpected invocation or a missing invocation, then it's sometimes difficult to debug which one is the problem.
There might be a better way, but my spitball idea would be to add an optional parameter to the annotation:
@Injectable("arg1") SomeClass arg1
The text was updated successfully, but these errors were encountered:
The name of a mock parameter, just like for mock fields, is already used in error messages, and in the matching of injection points to provided @Tested/@Injectable values. But what you ask for is something else, right? When a verification fails on arg1.expectedMethod(), the exception stack trace already points to the exact line in the test which failed, so we don't need the error message to mention "arg1".
Anyway, this would be costly to implement, and I don't really see the value.
It would be extremely helpful to have the ability to "name" mock instances so that they would show up with that name in toString calls (or at least in the error messages for validations). It is not always possible to only have a single mock instance of a given type so having the ability to quickly see what happened in the error output would save a bit of time.
`
@test
void myTest(
@Injectable SomeClass arg1,
@Injectable SomeClass arg2
) {
MyTestClass testClass = new MyTestClass();
}
`
[I am totally failing at the markdown, no idea why it won't format correctly]
If the validation fails because of an unexpected invocation or a missing invocation, then it's sometimes difficult to debug which one is the problem.
There might be a better way, but my spitball idea would be to add an optional parameter to the annotation:
@Injectable("arg1") SomeClass arg1
The text was updated successfully, but these errors were encountered: