Skip to content

Commit 83e638b

Browse files
committed
fix resttemplate CustomTest for JUnit 5
1 parent b14bc7a commit 83e638b

File tree

1 file changed

+10
-12
lines changed
  • samples/client/echo_api/java/resttemplate/src/test/java/org/openapitools/client

1 file changed

+10
-12
lines changed

samples/client/echo_api/java/resttemplate/src/test/java/org/openapitools/client/CustomTest.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,20 @@
1313

1414
package org.openapitools.client;
1515

16-
import org.junit.Assert;
17-
import org.junit.Test;
16+
import org.junit.jupiter.api.Assertions;
17+
import org.junit.jupiter.api.Test;
1818
import org.openapitools.client.api.BodyApi;
1919
import org.openapitools.client.api.QueryApi;
2020
import org.openapitools.client.model.Category;
2121
import org.openapitools.client.model.Pet;
2222

2323
import java.util.Arrays;
2424

25-
import static org.junit.Assert.assertNotNull;
26-
2725

2826
/**
2927
* API tests
3028
*/
31-
public class CustomTest {
29+
class CustomTest {
3230

3331
private final QueryApi api = new QueryApi();
3432
private final BodyApi bodyApi = new BodyApi();
@@ -40,22 +38,22 @@ public class CustomTest {
4038
*
4139
*/
4240
@Test
43-
public void testEchoBodyPet() {
41+
void testEchoBodyPet() {
4442
Pet pet = new Pet().id(12345L).name("Hello World").
4543
photoUrls(Arrays.asList(new String[]{"http://a.com", "http://b.com"})).category(new Category().id(987L).name("new category"));
4644

4745
Pet p = bodyApi.testEchoBodyPet(pet);
48-
assertNotNull(p);
49-
Assert.assertEquals("Hello World", p.getName());
50-
Assert.assertEquals(Long.valueOf(12345L), p.getId());
46+
Assertions.assertNotNull(p);
47+
Assertions.assertEquals("Hello World", p.getName());
48+
Assertions.assertEquals(Long.valueOf(12345L), p.getId());
5149

5250
// response is empty body
5351
Pet p2 = bodyApi.testEchoBodyPet(null);
54-
Assert.assertNull(p2);
52+
Assertions.assertNull(p2);
5553
}
5654

5755
@Test
58-
public void testQueryParamsExploded_whenQueryParamIsNull() {
59-
assertNotNull(api.testQueryStyleFormExplodeTrueObject(null));
56+
void testQueryParamsExploded_whenQueryParamIsNull() {
57+
Assertions.assertNotNull(api.testQueryStyleFormExplodeTrueObject(null));
6058
}
6159
}

0 commit comments

Comments
 (0)