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

upgrade microprofile to junit5 #18669

Merged
merged 10 commits into from
May 14, 2024
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 @@ -4,9 +4,13 @@ package {{package}};

{{#imports}}import {{import}};
{{/imports}}
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
{{#generateSpringBootApplication}}
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.test.context.junit.jupiter.SpringExtension;
{{/generateSpringBootApplication}}

import org.eclipse.microprofile.rest.client.RestClientBuilder;

Expand All @@ -26,7 +30,7 @@ import java.util.Set;
* API tests for {{classname}}
*/
{{#generateSpringBootApplication}}
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
@SpringApplicationConfiguration(classes = SpringBootApplication.class)
@WebAppConfiguration
@IntegrationTest("server.port=0")
Expand All @@ -36,7 +40,7 @@ public class {{classname}}Test {
private {{classname}} client;
private String baseUrl = "http://localhost:9080";

@Before
@BeforeEach
public void setup() throws MalformedURLException {
{{#microprofile3}}
// TODO initialize the client
Expand Down Expand Up @@ -69,7 +73,7 @@ public class {{classname}}Test {
{{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}}
{{/allParams}}
//{{^vendorExtensions.x-java-is-response-void}}{{#microprofileMutiny}}Uni<{{{returnType}}}>{{/microprofileMutiny}}{{^microprofileMutiny}}{{{returnType}}}{{/microprofileMutiny}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
//{{#returnType}}assertNotNull(response);{{/returnType}}
//{{#returnType}}Assertions.assertNotNull(response);{{/returnType}}


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<kumuluzee-rest.version>1.2.3</kumuluzee-rest.version>
<kumuluzee-rest-client.version>1.4.1</kumuluzee-rest-client.version>
<cxf-rt-rs-extension-providers.version>3.2.6</cxf-rt-rs-extension-providers.version>
<junit-version>4.13</junit-version>
<junit-version>5.10.2</junit-version>
<jersey-version>2.28</jersey-version>
</properties>

Expand Down Expand Up @@ -70,8 +70,8 @@
<version>${cxf-rt-rs-extension-providers.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -212,7 +212,7 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>4.13.2</junit.version>
<junit.version>5.10.2</junit.version>
<logback.version>1.4.14</logback.version>
{{#useBeanValidation}}
<beanvalidation.version>3.0.2</beanvalidation.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -205,7 +205,7 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>4.13.2</junit.version>
<junit.version>5.10.2</junit.version>
<logback.version>1.4.14</logback.version>
{{#useBeanValidation}}
<beanvalidation.version>3.0.1</beanvalidation.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -154,7 +154,7 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<swagger.core.version>1.5.18</swagger.core.version>
<jetty.version>9.2.9.v20150224</jetty.version>
<junit.version>4.13.2</junit.version>
<junit.version>5.10.2</junit.version>
<logback.version>1.4.14</logback.version>
<cxf.version>3.2.7</cxf.version>
<jackson.jaxrs.version>2.15.2</jackson.jaxrs.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import java.io.File;
import org.openapitools.client.model.ModelApiResponse;
import org.openapitools.client.model.Pet;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;

import org.eclipse.microprofile.rest.client.RestClientBuilder;

Expand All @@ -40,7 +40,7 @@ public class PetApiTest {
private PetApi client;
private String baseUrl = "http://localhost:9080";

@Before
@BeforeEach
public void setup() throws MalformedURLException {
// TODO initialize the client
}
Expand All @@ -59,7 +59,7 @@ public void addPetTest() {
// TODO: test validations
Pet pet = null;
//Pet response = api.addPet(pet);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -78,7 +78,7 @@ public void deletePetTest() {
Long petId = null;
String apiKey = null;
//api.deletePet(petId, apiKey);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -96,7 +96,7 @@ public void findPetsByStatusTest() {
// TODO: test validations
List<String> status = null;
//List<Pet> response = api.findPetsByStatus(status);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -114,7 +114,7 @@ public void findPetsByTagsTest() {
// TODO: test validations
List<String> tags = null;
//List<Pet> response = api.findPetsByTags(tags);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -132,7 +132,7 @@ public void getPetByIdTest() {
// TODO: test validations
Long petId = null;
//Pet response = api.getPetById(petId);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -150,7 +150,7 @@ public void updatePetTest() {
// TODO: test validations
Pet pet = null;
//Pet response = api.updatePet(pet);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -170,7 +170,7 @@ public void updatePetWithFormTest() {
String name = null;
String status = null;
//api.updatePetWithForm(petId, name, status);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -190,7 +190,7 @@ public void uploadFileTest() {
String additionalMetadata = null;
org.apache.cxf.jaxrs.ext.multipart.Attachment _file = null;
//ModelApiResponse response = api.uploadFile(petId, additionalMetadata, _file);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
package org.openapitools.client.api;

import org.openapitools.client.model.Order;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;

import org.eclipse.microprofile.rest.client.RestClientBuilder;

Expand All @@ -38,7 +38,7 @@ public class StoreApiTest {
private StoreApi client;
private String baseUrl = "http://localhost:9080";

@Before
@BeforeEach
public void setup() throws MalformedURLException {
// TODO initialize the client
}
Expand All @@ -57,7 +57,7 @@ public void deleteOrderTest() {
// TODO: test validations
String orderId = null;
//api.deleteOrder(orderId);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -74,7 +74,7 @@ public void deleteOrderTest() {
public void getInventoryTest() {
// TODO: test validations
//Map<String, Integer> response = api.getInventory();
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -92,7 +92,7 @@ public void getOrderByIdTest() {
// TODO: test validations
Long orderId = null;
//Order response = api.getOrderById(orderId);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -110,7 +110,7 @@ public void placeOrderTest() {
// TODO: test validations
Order order = null;
//Order response = api.placeOrder(order);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

import java.util.Date;
import org.openapitools.client.model.User;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;

import org.eclipse.microprofile.rest.client.RestClientBuilder;

Expand All @@ -39,7 +39,7 @@ public class UserApiTest {
private UserApi client;
private String baseUrl = "http://localhost:9080";

@Before
@BeforeEach
public void setup() throws MalformedURLException {
// TODO initialize the client
}
Expand All @@ -58,7 +58,7 @@ public void createUserTest() {
// TODO: test validations
User user = null;
//api.createUser(user);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -76,7 +76,7 @@ public void createUsersWithArrayInputTest() {
// TODO: test validations
List<User> user = null;
//api.createUsersWithArrayInput(user);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -94,7 +94,7 @@ public void createUsersWithListInputTest() {
// TODO: test validations
List<User> user = null;
//api.createUsersWithListInput(user);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -112,7 +112,7 @@ public void deleteUserTest() {
// TODO: test validations
String username = null;
//api.deleteUser(username);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -130,7 +130,7 @@ public void getUserByNameTest() {
// TODO: test validations
String username = null;
//User response = api.getUserByName(username);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -149,7 +149,7 @@ public void loginUserTest() {
String username = null;
String password = null;
//String response = api.loginUser(username, password);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -166,7 +166,7 @@ public void loginUserTest() {
public void logoutUserTest() {
// TODO: test validations
//api.logoutUser();
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand All @@ -185,7 +185,7 @@ public void updateUserTest() {
String username = null;
User user = null;
//api.updateUser(username, user);
//assertNotNull(response);
//Assertions.assertNotNull(response);


}
Expand Down
Loading
Loading