Feign makes writing java http clients easier
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

2.7 KiB

Feign APT test generator

This module generates mock clients for tests based on feign interfaces

Usage

Just need to add this module to dependency list and Java Annotation Processing Tool will automatically pick up the jar and generate test clients.

There are 2 main alternatives to include this to a project:

  1. Just add to classpath and java compiler should automaticaly detect and run code generation. On maven this is done like this:
        <dependency>
            <groupId>io.github.openfeign.experimental</groupId>
            <artifactId>feign-apt-test-generator</artifactId>
            <version>${feign.version}</version>
            <scope>test</scope>
        </dependency>
  1. Use a purpose build tool that allow to pick output location and don't mix dependencies onto classpath
            <plugin>
                <groupId>com.mysema.maven</groupId>
                <artifactId>apt-maven-plugin</artifactId>
                <version>1.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/generated-test-sources/feign</outputDirectory>
                            <processor>feign.apttestgenerator.GenerateTestStubAPT</processor>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>io.github.openfeign.experimental</groupId>
                        <artifactId>feign-apt-test-generator</artifactId>
                        <version>${feign.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>feign-stubs-source</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-test-sources/feign</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>