Skip to content

Commit f187b3d

Browse files
committed
replaced ApiException for Exception on test classes
1 parent 6a98794 commit f187b3d

File tree

3 files changed

+28
-31
lines changed

3 files changed

+28
-31
lines changed

samples/custom-tests/java/v2/okhttp-gson/PetApiTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import com.github.tomakehurst.wiremock.WireMockServer;
1717
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
18-
import io.swagger.client.ApiException;
1918
import io.swagger.client.model.Pet;
2019
import org.junit.AfterClass;
2120
import org.junit.Assert;
@@ -82,10 +81,10 @@ public static void tearDown() {
8281
/**
8382
* Add a new pet to the store
8483
*
85-
* @throws ApiException if the Api call fails
84+
* @throws Exception if the Api call fails
8685
*/
8786
@Test
88-
public void addPetTest() throws ApiException {
87+
public void addPetTest() throws Exception {
8988
Pet body = new Pet()
9089
.id(10L)
9190
.name("doggie")
@@ -99,10 +98,10 @@ public void addPetTest() throws ApiException {
9998
/**
10099
* Deletes a pet
101100
*
102-
* @throws ApiException if the Api call fails
101+
* @throws Exception if the Api call fails
103102
*/
104103
@Test
105-
public void deletePetTest() throws ApiException {
104+
public void deletePetTest() throws Exception {
106105
Long petId = 10L;
107106
String apiKey = "abc123";
108107
api.deletePet(petId, apiKey);
@@ -115,10 +114,10 @@ public void deletePetTest() throws ApiException {
115114
* <p>
116115
* Multiple status values can be provided with comma separated strings
117116
*
118-
* @throws ApiException if the Api call fails
117+
* @throws Exception if the Api call fails
119118
*/
120119
@Test
121-
public void findPetsByStatusTest() throws ApiException {
120+
public void findPetsByStatusTest() throws Exception {
122121
List<String> status = Arrays.asList("available");
123122
List<Pet> response = api.findPetsByStatus(status);
124123

@@ -133,10 +132,10 @@ public void findPetsByStatusTest() throws ApiException {
133132
* <p>
134133
* Returns a single pet
135134
*
136-
* @throws ApiException if the Api call fails
135+
* @throws Exception if the Api call fails
137136
*/
138137
@Test
139-
public void getPetByIdTest() throws ApiException {
138+
public void getPetByIdTest() throws Exception {
140139
Long petId = 10L;
141140
Pet response = api.getPetById(petId);
142141

@@ -150,10 +149,10 @@ public void getPetByIdTest() throws ApiException {
150149
/**
151150
* Update an existing pet
152151
*
153-
* @throws ApiException if the Api call fails
152+
* @throws Exception if the Api call fails
154153
*/
155154
@Test
156-
public void updatePetTest() throws ApiException {
155+
public void updatePetTest() throws Exception {
157156
Pet body = new Pet()
158157
.id(10L)
159158
.name("doggie")

samples/custom-tests/java/v2/okhttp-gson/StoreApiTest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
package io.swagger.client.api;
1515

16-
import io.swagger.client.ApiException;
1716
import io.swagger.client.model.Order;
1817
import org.junit.Assert;
1918
import org.junit.Test;
@@ -83,11 +82,11 @@ public static void tearDown() {
8382
*
8483
* For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors
8584
*
86-
* @throws ApiException
85+
* @throws Exception
8786
* if the Api call fails
8887
*/
8988
@Test
90-
public void deleteOrderTest() throws ApiException {
89+
public void deleteOrderTest() throws Exception {
9190
Long orderId = 10L;
9291
api.deleteOrder(orderId);
9392

@@ -99,11 +98,11 @@ public void deleteOrderTest() throws ApiException {
9998
*
10099
* Returns a map of status codes to quantities
101100
*
102-
* @throws ApiException
101+
* @throws Exception
103102
* if the Api call fails
104103
*/
105104
@Test
106-
public void getInventoryTest() throws ApiException {
105+
public void getInventoryTest() throws Exception {
107106
Map<String, Integer> response = api.getInventory();
108107

109108
Assert.assertNotNull(response);
@@ -117,11 +116,11 @@ public void getInventoryTest() throws ApiException {
117116
*
118117
* For valid response try integer IDs with value &gt;&#x3D; 1 and &lt;&#x3D; 10. Other values will generated exceptions
119118
*
120-
* @throws ApiException
119+
* @throws Exception
121120
* if the Api call fails
122121
*/
123122
@Test
124-
public void getOrderByIdTest() throws ApiException {
123+
public void getOrderByIdTest() throws Exception {
125124
Long orderId = 10L;
126125
Order response = api.getOrderById(orderId);
127126
Assert.assertNotNull(response);
@@ -137,11 +136,11 @@ public void getOrderByIdTest() throws ApiException {
137136
*
138137
*
139138
*
140-
* @throws ApiException
139+
* @throws Exception
141140
* if the Api call fails
142141
*/
143142
@Test
144-
public void placeOrderTest() throws ApiException {
143+
public void placeOrderTest() throws Exception {
145144
Order body = new Order().id(10L)
146145
.petId(10L)
147146
.complete(false)

samples/custom-tests/java/v2/okhttp-gson/UserApiTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
package io.swagger.client.api;
1515

16-
import io.swagger.client.ApiException;
1716
import io.swagger.client.model.User;
1817
import org.junit.Assert;
1918
import org.junit.Test;
@@ -86,11 +85,11 @@ public static void tearDown() {
8685
*
8786
* This can only be done by the logged in user.
8887
*
89-
* @throws ApiException
88+
* @throws Exception
9089
* if the Api call fails
9190
*/
9291
@Test
93-
public void createUserTest() throws ApiException {
92+
public void createUserTest() throws Exception {
9493
User body = new User().id(10L).username("user1");
9594
api.createUser(body);
9695

@@ -102,11 +101,11 @@ public void createUserTest() throws ApiException {
102101
*
103102
*
104103
*
105-
* @throws ApiException
104+
* @throws Exception
106105
* if the Api call fails
107106
*/
108107
@Test
109-
public void createUsersWithArrayInputTest() throws ApiException {
108+
public void createUsersWithArrayInputTest() throws Exception {
110109
User user = new User().id(10L).username("user1");
111110
List<User> body = Arrays.asList(user);
112111
api.createUsersWithArrayInput(body);
@@ -119,11 +118,11 @@ public void createUsersWithArrayInputTest() throws ApiException {
119118
*
120119
*
121120
*
122-
* @throws ApiException
121+
* @throws Exception
123122
* if the Api call fails
124123
*/
125124
@Test
126-
public void createUsersWithListInputTest() throws ApiException {
125+
public void createUsersWithListInputTest() throws Exception {
127126
User user = new User().id(10L).username("user1");
128127
List<User> body = Arrays.asList(user);
129128
api.createUsersWithListInput(body);
@@ -136,11 +135,11 @@ public void createUsersWithListInputTest() throws ApiException {
136135
*
137136
* This can only be done by the logged in user.
138137
*
139-
* @throws ApiException
138+
* @throws Exception
140139
* if the Api call fails
141140
*/
142141
@Test
143-
public void deleteUserTest() throws ApiException {
142+
public void deleteUserTest() throws Exception {
144143
String username = "user1";
145144
api.deleteUser(username);
146145

@@ -152,11 +151,11 @@ public void deleteUserTest() throws ApiException {
152151
*
153152
*
154153
*
155-
* @throws ApiException
154+
* @throws Exception
156155
* if the Api call fails
157156
*/
158157
@Test
159-
public void getUserByNameTest() throws ApiException {
158+
public void getUserByNameTest() throws Exception {
160159
String username = "user1";
161160
User response = api.getUserByName(username);
162161

0 commit comments

Comments
 (0)