Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import java.util.logging.Logger;
{{#threetenbp}}
import org.threeten.bp.*;
{{/threetenbp}}
import feign.okhttp.OkHttpClient;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -51,6 +52,7 @@ public class ApiClient {
objectMapper = createObjectMapper();
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
feignBuilder = Feign.builder()
.client(new OkHttpClient())
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
.decoder(new JacksonDecoder(objectMapper))
.logger(new Slf4jLogger());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package {{package}};
import {{invokerPackage}}.ApiClient;
{{#imports}}import {{import}};
{{/imports}}
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;

{{^fullJavaUtil}}
import java.util.ArrayList;
Expand All @@ -16,11 +16,11 @@ import java.util.Map;
/**
* API tests for {{classname}}
*/
public class {{classname}}Test {
class {{classname}}Test {

private {{classname}} api;

@Before
@BeforeEach
public void setup() {
api = new ApiClient().buildClient({{classname}}.class);
}
Expand All @@ -32,7 +32,7 @@ public class {{classname}}Test {
* {{notes}}
*/
@Test
public void {{operationId}}Test() {
void {{operationId}}Test() {
{{#allParams}}
{{{dataType}}} {{paramName}} = null;
{{/allParams}}
Expand All @@ -51,7 +51,7 @@ public class {{classname}}Test {
* listing them out individually.
*/
@Test
public void {{operationId}}TestQueryMap() {
void {{operationId}}TestQueryMap() {
{{#allParams}}
{{^isQueryParam}}
{{{dataType}}} {{paramName}} = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ if(hasProperty('target') && target == 'android') {
}
}

test {
useJUnitPlatform()
}

ext {
swagger_annotations_version = "1.5.24"
jackson_version = "2.10.3"
Expand All @@ -106,7 +110,7 @@ ext {
{{/threetenbp}}
feign_version = "10.11"
feign_form_version = "3.8.0"
junit_version = "4.13.1"
junit_version = "5.7.0"
scribejava_version = "8.0.0"
}

Expand All @@ -116,6 +120,7 @@ dependencies {
implementation "io.github.openfeign:feign-core:$feign_version"
implementation "io.github.openfeign:feign-jackson:$feign_version"
implementation "io.github.openfeign:feign-slf4j:$feign_version"
implementation "io.github.openfeign:feign-okhttp:$feign_version"
implementation "io.github.openfeign.form:feign-form:$feign_form_version"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
Expand All @@ -136,5 +141,11 @@ dependencies {
implementation "com.github.scribejava:scribejava-core:$scribejava_version"
implementation "com.brsanthu:migbase64:2.2"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
testImplementation "junit:junit:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version"
testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2"
testImplementation "org.hamcrest:hamcrest:2.2"
testImplementation "commons-io:commons-io:2.8.0"
testImplementation "ch.qos.logback:logback-classic:1.2.3"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.24" % "compile",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"io.github.openfeign" % "feign-core" % "10.11" % "compile",
"io.github.openfeign" % "feign-jackson" % "10.11" % "compile",
"io.github.openfeign" % "feign-slf4j" % "10.11" % "compile",
"io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile",
"io.github.openfeign" % "feign-okhttp" % "10.11" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile",
Expand All @@ -22,7 +24,11 @@ lazy val root = (project in file(".")).
"com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile",
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"junit" % "junit" % "4.13.1" % "test",
"org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test",
"org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test",
"com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test",
"org.hamcrest" % "hamcrest" % "2.2" % "test",
"commons-io" % "commons-io" % "2.8.0" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{>licenseInfo}}

package {{package}};

{{#imports}}import {{import}};
{{/imports}}
import org.junit.jupiter.api.Test;

{{#fullJavaUtil}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
{{/fullJavaUtil}}

/**
* Model tests for {{classname}}
*/
class {{classname}}Test {
{{#models}}
{{#model}}
{{^vendorExtensions.x-is-one-of-interface}}
{{^isEnum}}
private final {{classname}} model = new {{classname}}();

{{/isEnum}}
/**
* Model tests for {{classname}}
*/
@Test
void test{{classname}}() {
// TODO: test {{classname}}
}

{{#allVars}}
/**
* Test the property '{{name}}'
*/
@Test
void {{name}}Test() {
// TODO: test {{name}}
}

{{/allVars}}
{{/vendorExtensions.x-is-one-of-interface}}
{{/model}}
{{/models}}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@
<artifactId>feign-form</artifactId>
<version>${feign-form-version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
<version>${feign-version}</version>
</dependency>

<!-- JSON processing: jackson -->
<dependency>
Expand Down Expand Up @@ -314,21 +319,39 @@

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>3.6.0</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<version>2.27.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>1.7.1</version>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -349,7 +372,7 @@
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
{{/threetenbp}}
<javax-annotation-version>1.3.2</javax-annotation-version>
<junit-version>4.13.1</junit-version>
<junit-version>5.7.0</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<scribejava-version>8.0.0</scribejava-version>
</properties>
Expand Down
15 changes: 13 additions & 2 deletions samples/client/petstore/java/feign-no-nullable/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,18 @@ if(hasProperty('target') && target == 'android') {
}
}

test {
useJUnitPlatform()
}

ext {
swagger_annotations_version = "1.5.24"
jackson_version = "2.10.3"
jackson_databind_version = "2.10.3"
jackson_threetenbp_version = "2.9.10"
feign_version = "10.11"
feign_form_version = "3.8.0"
junit_version = "4.13.1"
junit_version = "5.7.0"
scribejava_version = "8.0.0"
}

Expand All @@ -111,6 +115,7 @@ dependencies {
implementation "io.github.openfeign:feign-core:$feign_version"
implementation "io.github.openfeign:feign-jackson:$feign_version"
implementation "io.github.openfeign:feign-slf4j:$feign_version"
implementation "io.github.openfeign:feign-okhttp:$feign_version"
implementation "io.github.openfeign.form:feign-form:$feign_form_version"
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
Expand All @@ -120,5 +125,11 @@ dependencies {
implementation "com.github.scribejava:scribejava-core:$scribejava_version"
implementation "com.brsanthu:migbase64:2.2"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
testImplementation "junit:junit:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit_version"
testImplementation "com.github.tomakehurst:wiremock-jre8:2.27.2"
testImplementation "org.hamcrest:hamcrest:2.2"
testImplementation "commons-io:commons-io:2.8.0"
testImplementation "ch.qos.logback:logback-classic:1.2.3"
}
8 changes: 7 additions & 1 deletion samples/client/petstore/java/feign-no-nullable/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ lazy val root = (project in file(".")).
resolvers += Resolver.mavenLocal,
libraryDependencies ++= Seq(
"io.swagger" % "swagger-annotations" % "1.5.24" % "compile",
"com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile",
"io.github.openfeign" % "feign-core" % "10.11" % "compile",
"io.github.openfeign" % "feign-jackson" % "10.11" % "compile",
"io.github.openfeign" % "feign-slf4j" % "10.11" % "compile",
"io.github.openfeign.form" % "feign-form" % "3.8.0" % "compile",
"io.github.openfeign" % "feign-okhttp" % "10.11" % "compile",
"com.fasterxml.jackson.core" % "jackson-core" % "2.10.3" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.10.3" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.10.3" % "compile",
Expand All @@ -22,7 +24,11 @@ lazy val root = (project in file(".")).
"com.github.scribejava" % "scribejava-core" % "8.0.0" % "compile",
"com.brsanthu" % "migbase64" % "2.2" % "compile",
"javax.annotation" % "javax.annotation-api" % "1.3.2" % "compile",
"junit" % "junit" % "4.13.1" % "test",
"org.junit.jupiter" % "junit-jupiter" % "5.7.0" % "test",
"org.junit.jupiter" % "junit-jupiter-params" % "5.7.0" % "test",
"com.github.tomakehurst" % "wiremock-jre8" % "2.27.2" % "test",
"org.hamcrest" % "hamcrest" % "2.2" % "test",
"commons-io" % "commons-io" % "2.8.0" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)
)
41 changes: 32 additions & 9 deletions samples/client/petstore/java/feign-no-nullable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@
<artifactId>feign-form</artifactId>
<version>${feign-form-version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
<version>${feign-version}</version>
</dependency>

<!-- JSON processing: jackson -->
<dependency>
Expand Down Expand Up @@ -276,21 +281,39 @@

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>3.6.0</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<version>2.27.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>1.7.1</version>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -306,7 +329,7 @@
<jackson-databind-version>2.10.3</jackson-databind-version>
<jackson-threetenbp-version>2.9.10</jackson-threetenbp-version>
<javax-annotation-version>1.3.2</javax-annotation-version>
<junit-version>4.13.1</junit-version>
<junit-version>5.7.0</junit-version>
<maven-plugin-version>1.0.0</maven-plugin-version>
<scribejava-version>8.0.0</scribejava-version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.logging.Logger;

import org.threeten.bp.*;
import feign.okhttp.OkHttpClient;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -36,6 +37,7 @@ public ApiClient() {
objectMapper = createObjectMapper();
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
feignBuilder = Feign.builder()
.client(new OkHttpClient())
.encoder(new FormEncoder(new JacksonEncoder(objectMapper)))
.decoder(new JacksonDecoder(objectMapper))
.logger(new Slf4jLogger());
Expand Down
Loading