Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr/18222 #40

Closed
wants to merge 11 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package {{package}};
import {{invokerPackage}}.ApiException;
{{#imports}}import {{import}};
{{/imports}}
import org.junit.Test;
import org.junit.Ignore;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.time.LocalDate;
import java.time.OffsetDateTime;
Expand All @@ -19,7 +19,7 @@ import java.util.Map;
/**
* API tests for {{classname}}
*/
public class {{classname}}Test {
class {{classname}}Test {

private final {{classname}} api = new {{classname}}();

Expand All @@ -38,7 +38,7 @@ public class {{classname}}Test {
* if the Api call fails
*/
@Test
public void {{operationId}}Test() throws ApiException {
void {{operationId}}Test() throws ApiException {
//{{#allParams}}
//{{{dataType}}} {{paramName}} = null;
//{{/allParams}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ext {
{{/useBeanValidation}}
jersey_version = "1.19.4"
jodatime_version = "2.9.9"
junit_version = "4.13.2"
junit_version = "5.10.2"
}

dependencies {
Expand All @@ -149,4 +149,20 @@ dependencies {
implementation "jakarta.validation:jakarta.validation-api:$bean_validation_version"
{{/useBeanValidation}}
testImplementation "junit:junit:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}

test {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()

// Always run tests, even when nothing changed.
dependsOn 'cleanTest'

// Show test results.
testLogging {
events "passed", "skipped", "failed"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ package {{package}};

{{#imports}}import {{import}};
{{/imports}}
import org.junit.Test;
import org.junit.Ignore;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.web.client.RestClientException;

import java.time.LocalDate;
import java.time.OffsetDateTime;
Expand All @@ -17,8 +18,8 @@ import java.util.Map;
/**
* API tests for {{classname}}
*/
@Ignore
public class {{classname}}Test {
@Disabled
class {{classname}}Test {

private final {{classname}} api = new {{classname}}();

Expand All @@ -28,11 +29,11 @@ public class {{classname}}Test {
*
* {{notes}}
*
* @throws ApiException
* @throws RestClientException
* if the Api call fails
*/
@Test
public void {{operationId}}Test() {
void {{operationId}}Test() {
{{#allParams}}
{{#isFile}}{{#useAbstractionForFiles}}{{#collectionFormat}}java.util.Collection<org.springframework.core.io.Resource>{{/collectionFormat}}{{^collectionFormat}}org.springframework.core.io.Resource{{/collectionFormat}}{{/useAbstractionForFiles}}{{^useAbstractionForFiles}}{{{dataType}}}{{/useAbstractionForFiles}}{{/isFile}}{{^isFile}}{{{dataType}}}{{/isFile}} {{paramName}} = null;
{{/allParams}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ext {
jakarta_annotation_version = "1.3.5"
{{/useJakartaEe}}
jodatime_version = "2.9.9"
junit_version = "4.13.2"
junit_version = "5.10.2"
}

dependencies {
Expand Down Expand Up @@ -158,5 +158,20 @@ dependencies {
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version"
{{/withXml}}
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}

test {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()

// Always run tests, even when nothing changed.
dependsOn 'cleanTest'

// Show test results.
testLogging {
events "passed", "skipped", "failed"
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@
<forkMode>pertest</forkMode>
<useUnlimitedThreads>true</useUnlimitedThreads>
</configuration>
<dependencies>
<!--Custom provider and engine for Junit 5 to surefire-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down Expand Up @@ -339,11 +347,17 @@

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-platform-runner.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -379,6 +393,7 @@
{{#performBeanValidation}}
<hibernate-validator-version>5.4.3.Final</hibernate-validator-version>
{{/performBeanValidation}}
<junit-version>4.13.2</junit-version>
<junit-version>5.10.2</junit-version>
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
</properties>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ package {{package}};

{{#imports}}import {{import}};
{{/imports}}
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

/**
* Model tests for {{classname}}
*/
public class {{classname}}Test {
class {{classname}}Test {
{{#models}}
{{#model}}
{{^vendorExtensions.x-is-one-of-interface}}
Expand All @@ -23,7 +23,7 @@ public class {{classname}}Test {
* Model tests for {{classname}}
*/
@Test
public void test{{classname}}() {
void test{{classname}}() {
// TODO: test {{classname}}
}

Expand All @@ -32,7 +32,7 @@ public class {{classname}}Test {
* Test the property '{{name}}'
*/
@Test
public void {{name}}Test() {
void {{name}}Test() {
// TODO: test {{name}}
}

Expand Down
21 changes: 18 additions & 3 deletions modules/openapi-generator/src/main/resources/Java/pom.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@
<parallel>methods</parallel>
<forkMode>pertest</forkMode>
</configuration>
<dependencies>
<!--Custom provider and engine for Junit 5 to surefire-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down Expand Up @@ -335,11 +343,17 @@
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-platform-runner.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -362,6 +376,7 @@
<beanvalidation-version>3.0.2</beanvalidation-version>
{{/useBeanValidation}}
<maven-plugin-version>1.0.0</maven-plugin-version>
<junit-version>4.13.2</junit-version>
<junit-version>5.10.2</junit-version>
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
</properties>
</project>
19 changes: 17 additions & 2 deletions samples/client/echo_api/java/resttemplate/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ ext {
spring_web_version = "5.3.32"
jakarta_annotation_version = "1.3.5"
jodatime_version = "2.9.9"
junit_version = "4.13.2"
junit_version = "5.10.2"
}

dependencies {
Expand All @@ -117,5 +117,20 @@ dependencies {
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}

test {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()

// Always run tests, even when nothing changed.
dependsOn 'cleanTest'

// Show test results.
testLogging {
events "passed", "skipped", "failed"
}

}
21 changes: 18 additions & 3 deletions samples/client/echo_api/java/resttemplate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@
<forkMode>pertest</forkMode>
<useUnlimitedThreads>true</useUnlimitedThreads>
</configuration>
<dependencies>
<!--Custom provider and engine for Junit 5 to surefire-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down Expand Up @@ -258,11 +266,17 @@

<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-platform-runner.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -271,6 +285,7 @@
<jackson-databind-version>2.15.2</jackson-databind-version>
<jackson-databind-nullable-version>0.2.6</jackson-databind-nullable-version>
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
<junit-version>4.13.2</junit-version>
<junit-version>5.10.2</junit-version>
<junit-platform-runner.version>1.10.0</junit-platform-runner.version>
</properties>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ ext {
spring_web_version = "5.3.32"
jakarta_annotation_version = "1.3.5"
jodatime_version = "2.9.9"
junit_version = "4.13.2"
junit_version = "5.10.2"
}

dependencies {
Expand All @@ -117,5 +117,20 @@ dependencies {
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
testImplementation "junit:junit:$junit_version"
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
}

test {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()

// Always run tests, even when nothing changed.
dependsOn 'cleanTest'

// Show test results.
testLogging {
events "passed", "skipped", "failed"
}

}
Loading
Loading