0

I am using Spring Cloud Contract to test messaging contracts within our system. I have created the contract on the producer side, generated the stubs, and validated that the generated test passes as I expect. However, when I try to set up the related test on the consumer side, I am getting an AbstractMethodError, which seems to be caused by the AutoConfigureStubRunner annotation.

pom.xml dependencies

...
<properties>
   <spring-cloud-services-dependencies.version>1.5.0.RELEASE</spring-cloud-services-dependencies.version>
</properties>
...
<dependencyManagement>
   <dependencies>
      <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
            <scope>test</scope>
            <version>${spring-cloud-contract.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-contract-stub-runner</artifactId>
            <scope>test</scope>
            <version>${spring-cloud-contract.version}</version>
        </dependency>
   </dependencies>
</dependencyManagement>
...

Consumer side test class signature

@RunWith(SpringRunner.class)
@SpringBootTest(classes = {ConsumerApplicationRunner.class})
@AutoConfigureStubRunner(stubsMode = StubRunnerProperties.StubsMode.LOCAL, ids = {"com.example:producer-artifact"}, consumerName = "consumer", stubsPerConsumer = true)
public class MessagingTest {

Any ideas?

mgzwarrior
  • 53
  • 1
  • 6
  • You're using wrong versions of Spring Cloud Contract vs Spring Boot. Please go to start.spring.io and generate a new project with Spring Cloud Contract. There all the versions will be passed for you. – Marcin Grzejszczak Jun 06 '19 at 07:51
  • Thanks, @MarcinGrzejszczak! I will give that a try and let you know how it goes. – mgzwarrior Jun 07 '19 at 12:41

0 Answers0