Fork me on GitHub

Java Project with JUnit Tests

Sample minimal configuration for Java Project with JUnit tests.

Test dependencies for generated contract verification tests

                <dependency>
                        <groupId>org.springframework.cloud</groupId>
                        <artifactId>spring-cloud-starter-contract-verifier</artifactId>
                        <version>${it-plugin.version}</version>
                        <scope>test</scope>
                </dependency>

Project configuration for Spring Cloud Contract Verifier with JUnit tests and stub publishing

                        <plugin>
                                <groupId>org.springframework.cloud</groupId>
                                <artifactId>spring-cloud-contract-maven-plugin</artifactId>
                                <version>${spring-cloud-verifier-plugin.version}</version>
                                <extensions>true</extensions>
                                <configuration>
                                        <baseClassForTests>hello.BaseAccurest</baseClassForTests>
                                </configuration>
                        </plugin>

Base Test class

/*
 * Copyright 2013-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */package hello;

import io.restassured.module.mockmvc.RestAssuredMockMvc;
import org.junit.Before;

public class BaseAccurest {

        @Before
        public void setup() {
                RestAssuredMockMvc.standaloneSetup(new GreetingController());
        }

}