Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifications not working with TestNG 6.11 #463

Closed
WatchfulLikeACrane opened this issue Sep 25, 2017 · 0 comments
Closed

Verifications not working with TestNG 6.11 #463

WatchfulLikeACrane opened this issue Sep 25, 2017 · 0 comments
Assignees
Labels
bug

Comments

@WatchfulLikeACrane
Copy link

@WatchfulLikeACrane WatchfulLikeACrane commented Sep 25, 2017

  • 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.

@rliesenfeld rliesenfeld self-assigned this Sep 26, 2017
@rliesenfeld rliesenfeld added the bug label Sep 26, 2017
@jmockit jmockit locked and limited conversation to collaborators Oct 11, 2017
@rliesenfeld rliesenfeld changed the title Verifications not working with Verifications not working with TestNG 6.11 Oct 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.