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

[issue-253] migrated from junit4 to junit5 #256

Merged
merged 1 commit into from
Apr 1, 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
8 changes: 6 additions & 2 deletions .github/workflows/wildfly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
schedule:
- cron: '0 0 * * *' # Every day at 00:00 UTC

env:
GALLEON_VERSION: 7.0.0.Beta5
WILDFLY_MP_VERSION: 5.0.0.Beta3

# Only run the latest job and cancel previous ones
concurrency:
group: 'wildfly-${{ github.ref || github.run_id }}'
Expand Down Expand Up @@ -46,7 +50,7 @@ jobs:
distribution: 'temurin'
cache: 'maven'
- name: Build with Maven Java ${{ matrix.java }}
run: mvn -B clean install '-Dversion.org.wildfly=${{ needs.wildfly-build.outputs.wildfly-version }}'
run: mvn -B clean install '-Dversion.org.wildfly=${{ needs.wildfly-build.outputs.wildfly-version }}' '-Dversion.org.wildfly.galleon-plugins=${{ env.GALLEON_VERSION}}' '-Dversion.org.wildfly.plugins.wildfly-maven-plugin=${{ env.WILDFLY_MP_VERSION}}'
- name: Upload surefire reports
uses: actions/upload-artifact@v4
if: failure()
Expand Down Expand Up @@ -84,7 +88,7 @@ jobs:
cache: 'maven'
- name: Build with Maven Java ${{ matrix.java }} on WildFly ${{ matrix.wildfly-version }} - ${{ matrix.os }}
run: |
mvn clean install -U -B -fae '-Dserver.version=${{ matrix.wildfly-version }}' '-Dgithub.actions'
mvn clean install -U -B -fae '-Dserver.version=${{ matrix.wildfly-version }}' '-Dgithub.actions' '-Dversion.org.wildfly.galleon-plugins=${{ env.GALLEON_VERSION}}' '-Dversion.org.wildfly.plugins.wildfly-maven-plugin=${{ env.WILDFLY_MP_VERSION}}'
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<version.org.wildfly.common>1.7.0.Final</version.org.wildfly.common>

<version.junit>4.13.2</version.junit>
<version.org.junit>5.10.2</version.org.junit>

<!-- Test only dependencies -->
<version.com.github.tomakehurst.wiremock>2.27.2</version.com.github.tomakehurst.wiremock>
Expand Down
4 changes: 2 additions & 2 deletions rest-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@

<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
import org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class ClientHeadersDefaultFactoryCDITest {

Expand Down Expand Up @@ -104,7 +104,7 @@ public Set<Class<?>> getClasses() {
}
}

@Before
@BeforeEach
public void init() {
Weld weld = new Weld();
weld.addBeanClass(Worker.class);
Expand All @@ -114,7 +114,7 @@ public void init() {
undertowJaxrsServer.deploy(MyApp.class);
}

@After
@AfterEach
public void stop() {
if (undertowJaxrsServer != null) {
undertowJaxrsServer.stop();
Expand All @@ -127,7 +127,7 @@ public void stop() {
@Test
public void test() {
String result = weldContainer.select(Worker.class).get().work();
Assert.assertTrue(result.contains("IntfHeader: intfValue"));
Assert.assertTrue(result.contains("MthdHeader: hello"));
Assertions.assertTrue(result.contains("IntfHeader: intfValue"));
Assertions.assertTrue(result.contains("MthdHeader: hello"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
import org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

public class ClientHeadersFactoryCDITest {

Expand Down Expand Up @@ -122,7 +122,7 @@ public Set<Class<?>> getClasses() {
}
}

@BeforeClass
@BeforeAll
public static void init() {
Weld weld = new Weld();
weld.addBeanClass(Worker.class);
Expand All @@ -134,17 +134,17 @@ public static void init() {
server.deploy(MyApp.class);
}

@AfterClass
@AfterAll
public static void stop() {
server.stop();
container.shutdown();
}

@Test
public void test() {
Assert.assertTrue(container.isRunning());
Assertions.assertTrue(container.isRunning());
String result = container.select(Worker.class).get().work();
Assert.assertEquals("hello Stefano", result);
Assert.assertEquals(1, Counter.COUNT.get());
Assertions.assertEquals("hello Stefano", result);
Assertions.assertEquals(1, Counter.COUNT.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import jakarta.ws.rs.PathParam;

import org.eclipse.microprofile.rest.client.RestClientBuilder;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
* @author <a href="mailto:[email protected]">James R. Perkins</a>
Expand All @@ -42,7 +42,7 @@ public class CloseableClientTest {
public void buildAutoCloseableClientWithUriTemplate() {
AutoCloseableClientWithUriTemplate client = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost"))
.build(AutoCloseableClientWithUriTemplate.class);
Assert.assertNotNull(client);
Assertions.assertNotNull(client);
}

/**
Expand All @@ -52,7 +52,7 @@ public void buildAutoCloseableClientWithUriTemplate() {
public void buildCloseableClientWithUriTemplate() {
CloseableClientWithUriTemplate client = RestClientBuilder.newBuilder().baseUri(URI.create("http://localhost"))
.build(CloseableClientWithUriTemplate.class);
Assert.assertNotNull(client);
Assertions.assertNotNull(client);
}

@Path("/{name}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@
import org.jboss.resteasy.plugins.providers.DefaultTextPlain;
import org.jboss.resteasy.plugins.providers.IIOImageProvider;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public class ProviderFactoryTest {

@Test
public void testDefaultProvider() {
RestClientBuilderImpl builder = (RestClientBuilderImpl) RestClientBuilder.newBuilder();

Assert.assertTrue(builder.getBuilderDelegate()
Assertions.assertTrue(builder.getBuilderDelegate()
.getProviderFactory()
.getProviderClasses()
.contains(IIOImageProvider.class));
Assert.assertTrue(builder.getBuilderDelegate()
Assertions.assertTrue(builder.getBuilderDelegate()
.getProviderFactory()
.getProviderClasses()
.contains(DefaultTextPlain.class));
Expand All @@ -52,11 +52,11 @@ public void testCustomProvider() {

RestClientBuilderImpl builder = (RestClientBuilderImpl) RestClientBuilder.newBuilder();

Assert.assertTrue(builder.getBuilderDelegate()
Assertions.assertTrue(builder.getBuilderDelegate()
.getProviderFactory()
.getProviderClasses()
.contains(IIOImageProvider.class));
Assert.assertFalse(builder.getBuilderDelegate()
Assertions.assertFalse(builder.getBuilderDelegate()
.getProviderFactory()
.getProviderClasses()
.contains(DefaultTextPlain.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.net.URI;

import org.eclipse.microprofile.rest.client.RestClientBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class RESTEASY_2335_Test {
public static final String HTTP_LOCALHOST_8080 = "http://localhost:8080";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.jboss.resteasy.microprofile.client.headers;

import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand All @@ -34,23 +35,22 @@
import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.jboss.resteasy.annotations.jaxrs.HeaderParam;
import org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

public class ClientHeaderFillingTest {
private static final String HEADER_NAME = "GENERATED_HEADER";

private static UndertowJaxrsServer server;
private static WeldContainer container;

@BeforeClass
@BeforeAll
public static void init() {
Weld weld = new Weld();
weld.addBeanClass(HeaderPassingResource.class);
Expand All @@ -64,10 +64,10 @@ public static void init() {
@Test
public void checkIfFillerFactoryWithHigherPrioritySelected() {
List<String> result = container.select(ClientInvokingBean.class).get().getHeaders();
MatcherAssert.assertThat(result, CoreMatchers.hasItems("high", "prio"));
Assertions.assertTrue(hasItems(result, "high", "prio"));
}

@AfterClass
@AfterAll
public static void stop() {
server.stop();
container.shutdown();
Expand Down Expand Up @@ -115,4 +115,8 @@ public Set<Class<?>> getClasses() {
return classes;
}
}

private static boolean hasItems(Collection<String> items, String... controlList) {
return items.containsAll(List.of(controlList));
}
}
10 changes: 5 additions & 5 deletions resteasy-microprofile-test-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<version.org.eclipse.parsson>1.1.4</version.org.eclipse.parsson>
<version.org.eclipse.yasson>3.0.2</version.org.eclipse.yasson>

<version.org.jboss.arquillian>1.7.1.Final</version.org.jboss.arquillian>
<version.org.jboss.arquillian.container.arquillian-weld-embedded>3.0.2.Final</version.org.jboss.arquillian.container.arquillian-weld-embedded>
<version.org.jboss.arquillian>1.7.2.Final</version.org.jboss.arquillian>
<version.org.jboss.arquillian.container.arquillian-weld-embedded>4.0.0.Final</version.org.jboss.arquillian.container.arquillian-weld-embedded>
<version.org.jboss.dmr>1.7.0.Final</version.org.jboss.dmr>
<version.org.jboss.shrinkwrap.resolver>3.3.0</version.org.jboss.shrinkwrap.resolver>
<version.org.jboss.weld>5.1.0.Final</version.org.jboss.weld>
Expand Down Expand Up @@ -175,9 +175,9 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${version.org.junit}</version>
<scope>test</scope>
</dependency>

Expand Down
19 changes: 11 additions & 8 deletions testsuite/integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
<feature.pack.artifactId>galleon-feature-pack</feature.pack.artifactId>
<feature.pack.version>${project.version}</feature.pack.version>


<version.arquillian.junit5>1.7.2.Final</version.arquillian.junit5>
<jboss.arguments/>
</properties>

Expand Down Expand Up @@ -96,8 +98,15 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${version.org.junit}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -125,12 +134,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-json-binding-provider</artifactId>
Expand Down
Loading