Capturing+Spring Missing invocations #373

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

Projects

None yet

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();
                }
            };
        }
    }
}
@rliesenfeld rliesenfeld self-assigned this Dec 22, 2016
@rliesenfeld rliesenfeld added the bug label Dec 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment