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

Capturing+Spring Missing invocations #373

Closed
Milbor opened this Issue Dec 19, 2016 · 0 comments

Comments

2 participants
@Milbor

Milbor commented Dec 19, 2016

We made another unsuccessful attempt to upgrade from 1.25.
This test fails in 1.30, passes in 1.28.

@ContextConfiguration(classes = TestConfig.class)
public class SpikeTest extends AbstractTestNGSpringContextTests {
    @Capturing
    private SubManager manager;

    @Autowired
    private SUT sut;

    @Test
    public void test() throws Exception {
        new Expectations() {{
            manager.manage();
        }};
        sut.call();
    }

    public interface Manager {
        void manage();
    }

    public interface SubManager extends Manager {
    }

    public static class SUT {
        @Autowired
        private SubManager manager;

        void call() {
            manager.manage();
        }
    }

    @Configuration
    public static class TestConfig {
        @Bean
        protected SUT sut() {
            return new SUT();
        }

        @Bean
        protected SubManager manager() {
            return new SubManager() {
                @Override
                public void manage() {
                    throw new UnsupportedOperationException();
                }
            };
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment