Skip to content

Commit 5d546f0

Browse files
committed
Update to junit5
Signed-off-by: Jorge Bescos Gascon <[email protected]>
1 parent 2ddc393 commit 5d546f0

File tree

3 files changed

+32
-26
lines changed

3 files changed

+32
-26
lines changed

tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource1Test.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -14,10 +14,9 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
*/
1616

17-
1817
package org.glassfish.jersey.tests.e2e.server;
1918

20-
import static org.junit.Assert.assertEquals;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
2120

2221
import javax.ws.rs.GET;
2322
import javax.ws.rs.Path;
@@ -26,16 +25,15 @@
2625

2726
import org.glassfish.jersey.server.ResourceConfig;
2827
import org.glassfish.jersey.test.JerseyTest;
29-
import org.junit.Test;
28+
import org.junit.jupiter.api.Test;
3029

3130
public class Issue4780Resource1Test extends JerseyTest {
3231

3332
// 1 interface and 1 implementation having same @Path
3433
@Test
3534
public void resource1() throws Exception {
3635
Response response = target().path("/resource1").request().get();
37-
response.bufferEntity();
38-
assertEquals(response.readEntity(String.class), 200, response.getStatus());
36+
assertEquals(200, response.getStatus());
3937
}
4038

4139
@Override

tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource2Test.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -14,28 +14,32 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
*/
1616

17-
1817
package org.glassfish.jersey.tests.e2e.server;
1918

19+
import static org.junit.jupiter.api.Assertions.assertThrows;
20+
2021
import javax.ws.rs.GET;
2122
import javax.ws.rs.Path;
2223

2324
import org.glassfish.jersey.server.ResourceConfig;
2425
import org.glassfish.jersey.server.model.ModelValidationException;
2526
import org.glassfish.jersey.test.JerseyTest;
26-
import org.junit.Test;
27+
import org.junit.jupiter.api.Test;
2728

2829
public class Issue4780Resource2Test {
2930

3031
// 2 interfaces having same @Path
31-
@Test(expected = ModelValidationException.class)
32+
@Test
3233
public void resource2() throws Exception {
33-
JerseyTest test = new JerseyTest(new ResourceConfig(IResource2_1.class, IResource2_2.class)) {};
34-
try {
35-
test.setUp();
36-
} finally {
37-
test.tearDown();
38-
}
34+
assertThrows(ModelValidationException.class, () -> {
35+
JerseyTest test = new JerseyTest(new ResourceConfig(IResource2_1.class, IResource2_2.class)) {
36+
};
37+
try {
38+
test.setUp();
39+
} finally {
40+
test.tearDown();
41+
}
42+
});
3943
}
4044

4145
@Path("")

tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource3Test.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -14,28 +14,32 @@
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
*/
1616

17-
1817
package org.glassfish.jersey.tests.e2e.server;
1918

19+
import static org.junit.jupiter.api.Assertions.assertThrows;
20+
2021
import javax.ws.rs.GET;
2122
import javax.ws.rs.Path;
2223

2324
import org.glassfish.jersey.server.ResourceConfig;
2425
import org.glassfish.jersey.server.model.ModelValidationException;
2526
import org.glassfish.jersey.test.JerseyTest;
26-
import org.junit.Test;
27+
import org.junit.jupiter.api.Test;
2728

2829
public class Issue4780Resource3Test {
2930

3031
// 2 classes having same @Path
31-
@Test(expected = ModelValidationException.class)
32+
@Test
3233
public void resource3() throws Exception {
33-
JerseyTest test = new JerseyTest(new ResourceConfig(Resource3_1.class, Resource3_2.class)) {};
34-
try {
35-
test.setUp();
36-
} finally {
37-
test.tearDown();
38-
}
34+
assertThrows(ModelValidationException.class, () -> {
35+
JerseyTest test = new JerseyTest(new ResourceConfig(Resource3_1.class, Resource3_2.class)) {
36+
};
37+
try {
38+
test.setUp();
39+
} finally {
40+
test.tearDown();
41+
}
42+
});
3943
}
4044

4145
@Path("")

0 commit comments

Comments
 (0)