tests for convert goal
This commit is contained in:
@@ -6,6 +6,7 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import io.takari.maven.testing.TestProperties;
|
||||
import io.takari.maven.testing.TestResources;
|
||||
import io.takari.maven.testing.executor.MavenRuntime;
|
||||
import io.takari.maven.testing.executor.MavenVersions;
|
||||
@@ -18,6 +19,8 @@ public class PluginIntegrationTest {
|
||||
@Rule
|
||||
public final TestResources resources = new TestResources();
|
||||
|
||||
private final TestProperties properties = new TestProperties();
|
||||
|
||||
private final MavenRuntime maven;
|
||||
|
||||
public PluginIntegrationTest(MavenRuntime.MavenRuntimeBuilder mavenBuilder) throws Exception {
|
||||
@@ -25,29 +28,27 @@ public class PluginIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateStubs() throws Exception {
|
||||
File basedir = resources.getBasedir("basic-with-execution");
|
||||
maven.forProject(basedir)
|
||||
.withCliOption("-X")
|
||||
.execute("package")
|
||||
.assertLogText("Accurest Plugin: Invoking GroovyDSL to WireMock client stubs conversion");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCreateSpecs() throws Exception {
|
||||
File basedir = resources.getBasedir("basic-with-execution");
|
||||
maven.forProject(basedir)
|
||||
.execute("package")
|
||||
.assertLogText("Accurest Plugin: Invoking test sources generation");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldBuildAndTestSimpleBootProject() throws Exception {
|
||||
public void shouldBuildSimpleBootWIthAccurtesProject() throws Exception {
|
||||
File basedir = resources.getBasedir("bootSimple");
|
||||
maven.forProject(basedir)
|
||||
.execute("package")
|
||||
.assertErrorFreeLog()
|
||||
.assertLogText("Accurest Plugin: Invoking test sources generation")
|
||||
.assertLogText("Generated 1 test classes.");
|
||||
.assertLogText("Generated 1 test classes.")
|
||||
.assertLogText("Accurest Plugin: Invoking GroovyDSL to WireMock client stubs conversion")
|
||||
.assertLogText("Creating new json")
|
||||
.assertErrorFreeLog();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldConvertAccurestToWireMockStubs() throws Exception {
|
||||
File basedir = resources.getBasedir("pomless");
|
||||
properties.getPluginVersion();
|
||||
maven.forProject(basedir)
|
||||
.withCliOption("-X")
|
||||
.execute(String.format("io.codearte.accurest:accurest-maven-plugin:%s:convert", properties.getPluginVersion()))
|
||||
.assertLogText("Converting from accurest contracts written in GroovyDSL to WireMock stubs mappings")
|
||||
.assertLogText("Creating new json")
|
||||
.assertErrorFreeLog();
|
||||
}
|
||||
}
|
||||
@@ -46,4 +46,5 @@ public class PluginUnitTest {
|
||||
assertFilesPresent(basedir,
|
||||
"target/generated-test-sources/accurest/io/codearte/accurest/tests/AccurestSpec.groovy");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>io.codearte.accurest.sample</groupId>
|
||||
<artifactId>sample-project</artifactId>
|
||||
<version>0.1</version>
|
||||
|
||||
<dependencies>
|
||||
<!--TODO: Replace this stuff with import accurest-test dependency-->
|
||||
<dependency>
|
||||
<groupId>org.spockframework</groupId>
|
||||
<artifactId>spock-core</artifactId>
|
||||
<version>1.0-groovy-2.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.restassured</groupId>
|
||||
<artifactId>rest-assured</artifactId>
|
||||
<version>2.9.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.restassured</groupId>
|
||||
<artifactId>spring-mock-mvc</artifactId>
|
||||
<version>2.9.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.tomakehurst</groupId>
|
||||
<artifactId>wiremock</artifactId>
|
||||
<version>2.0.4-beta</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.toomuchcoding.jsonassert</groupId>
|
||||
<artifactId>jsonassert</artifactId>
|
||||
<version>0.2.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>io.codearte.accurest</groupId>
|
||||
<artifactId>accurest-maven-plugin</artifactId>
|
||||
<version>${it-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>generateStubs</goal>
|
||||
<goal>generateSpecs</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.gmavenplus</groupId>
|
||||
<artifactId>gmavenplus-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>testCompile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<testSources>
|
||||
<testSource>
|
||||
<directory>${project.basedir}/src/test/groovy</directory>
|
||||
<includes>
|
||||
<include>**/*.groovy</include>
|
||||
</includes>
|
||||
</testSource>
|
||||
<testSource>
|
||||
<directory>${project.build.directory}/generated-test-sources/accurest</directory>
|
||||
<includes>
|
||||
<include>**/*.groovy</include>
|
||||
</includes>
|
||||
</testSource>
|
||||
</testSources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.19</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Spec.java</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
Reference in New Issue
Block a user