diff --git a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource1Test.java b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource1Test.java index 01ca2e4f18..e474d243e5 100644 --- a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource1Test.java +++ b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource1Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,10 +14,9 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ - package org.glassfish.jersey.tests.e2e.server; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -26,7 +25,7 @@ import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Issue4780Resource1Test extends JerseyTest { @@ -34,8 +33,7 @@ public class Issue4780Resource1Test extends JerseyTest { @Test public void resource1() throws Exception { Response response = target().path("/resource1").request().get(); - response.bufferEntity(); - assertEquals(response.readEntity(String.class), 200, response.getStatus()); + assertEquals(200, response.getStatus()); } @Override diff --git a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource2Test.java b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource2Test.java index 3e3af13c64..f1bdeed5f3 100644 --- a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource2Test.java +++ b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource2Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,28 +14,32 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ - package org.glassfish.jersey.tests.e2e.server; +import static org.junit.jupiter.api.Assertions.assertThrows; + import javax.ws.rs.GET; import javax.ws.rs.Path; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.model.ModelValidationException; import org.glassfish.jersey.test.JerseyTest; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Issue4780Resource2Test { // 2 interfaces having same @Path - @Test(expected = ModelValidationException.class) + @Test public void resource2() throws Exception { - JerseyTest test = new JerseyTest(new ResourceConfig(IResource2_1.class, IResource2_2.class)) {}; - try { - test.setUp(); - } finally { - test.tearDown(); - } + assertThrows(ModelValidationException.class, () -> { + JerseyTest test = new JerseyTest(new ResourceConfig(IResource2_1.class, IResource2_2.class)) { + }; + try { + test.setUp(); + } finally { + test.tearDown(); + } + }); } @Path("") diff --git a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource3Test.java b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource3Test.java index 6a88d11e71..fe6868b895 100644 --- a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource3Test.java +++ b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/Issue4780Resource3Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -14,28 +14,32 @@ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ - package org.glassfish.jersey.tests.e2e.server; +import static org.junit.jupiter.api.Assertions.assertThrows; + import javax.ws.rs.GET; import javax.ws.rs.Path; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.model.ModelValidationException; import org.glassfish.jersey.test.JerseyTest; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class Issue4780Resource3Test { // 2 classes having same @Path - @Test(expected = ModelValidationException.class) + @Test public void resource3() throws Exception { - JerseyTest test = new JerseyTest(new ResourceConfig(Resource3_1.class, Resource3_2.class)) {}; - try { - test.setUp(); - } finally { - test.tearDown(); - } + assertThrows(ModelValidationException.class, () -> { + JerseyTest test = new JerseyTest(new ResourceConfig(Resource3_1.class, Resource3_2.class)) { + }; + try { + test.setUp(); + } finally { + test.tearDown(); + } + }); } @Path("")