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

Chained mocking not working in BeforeMethod #444

Milbor-zz opened this issue Aug 15, 2017 · 0 comments

Chained mocking not working in BeforeMethod #444

Milbor-zz opened this issue Aug 15, 2017 · 0 comments


Copy link

@Milbor-zz Milbor-zz commented Aug 15, 2017

1.33 fail
1.32 green

import java.util.List;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;


import mockit.Expectations;
import mockit.Mocked;

import static org.testng.Assert.assertNotNull;

public class JmockitTest {
    private ContextData contextData;

    public void setUp() throws Exception {
        new Expectations() {{
            result = ImmutableList.of(new Account());

    public void test() throws Exception {

    interface ContextData {
        User getUser();

    static class User {
        private List<Account> accounts;

        public List<Account> getAccounts() {
            return accounts;

        public void setAccounts(final List<Account> accounts) {
            this.accounts = accounts;

    static class Account {
@rliesenfeld rliesenfeld self-assigned this Aug 15, 2017
@jmockit jmockit locked and limited conversation to collaborators Sep 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

No branches or pull requests

2 participants