-
Notifications
You must be signed in to change notification settings - Fork 238
Verifications not working with TestNG 6.11 #463
Copy link
Copy link
Closed
Labels
Description
- JMockit: 1.35
- TestNG: 6.11
Verifications block throws in the following code:
public class Test {
public interface Dependency {
void call();
}
static class TestedClass {
public void testedMethod(Dependency dependency) {
dependency.call();
}
}
@org.testng.annotations.Test
public void test(@Injectable Dependency dependency) {
TestedClass tested = new TestedClass();
tested.testedMethod(dependency);
new Verifications() {{
dependency.call(); times = 1; // throws: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
}};
}
}
Exception is thrown by the UnorderedVerificationPhase.handleInvocationCountConstraint(...) Line: 88, because the expectationsInReplayOrder is empty. Problem occurs only when the interface is public (also when located in different file) and only when Dependency is mocked as the parameter of the test method. Mocking a class in a similar manners works.
Reactions are currently unavailable