Skip to content

Commit

Permalink
Convert to JUnit 5 tests #430
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed Sep 29, 2018
1 parent 9a04a5e commit 36ff55c
Show file tree
Hide file tree
Showing 314 changed files with 6,812 additions and 6,088 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,11 @@ stop:
pkill redis-sentinel && sleep 1 || true

test-coverage: start
mvn -B -DskipTests=false clean compile test jacoco:report -P$(PROFILE)
mvn -B -DskipITs=false clean compile verify jacoco:report -P$(PROFILE)
$(MAKE) stop

test: start
mvn -B -DskipTests=false clean compile test -P$(PROFILE)
mvn -B -DskipITs=false clean compile verify -P$(PROFILE)
$(MAKE) stop

prepare: stop
Expand Down
125 changes: 107 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- You need a running redis+sentinel for all tests, therefore disabled by default -->
<skipTests>true</skipTests>
<netty-version>4.1.29.Final</netty-version>
<spring-version>4.3.19.RELEASE</spring-version>
<reactor-version>3.2.0.RELEASE</reactor-version>
<brave-version>5.2.0</brave-version>
<skipITs>true</skipITs>
</properties>

<scm>
Expand Down Expand Up @@ -250,7 +250,7 @@
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.0</version>
<version>2.0</version>
<optional>true</optional>
</dependency>

Expand All @@ -270,6 +270,20 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
Expand All @@ -291,6 +305,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>2.22.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.code.tempus-fugit</groupId>
<artifactId>tempus-fugit</artifactId>
Expand All @@ -299,9 +320,16 @@
</dependency>

<dependency>
<groupId>org.apache.openwebbeans.test</groupId>
<artifactId>cditest-owb</artifactId>
<version>1.2.8</version>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-se</artifactId>
<version>2.0.6</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -381,6 +409,20 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>

</dependencies>

<profiles>
Expand All @@ -399,7 +441,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand All @@ -422,7 +464,7 @@
<link>https://projectreactor.io/docs/core/release/api/</link>
<link>https://docs.spring.io/spring/docs/current/javadoc-api/</link>
</links>
<additionalparam>-Xdoclint:none</additionalparam>
<doclint>none</doclint>
<quiet>true</quiet>
<tags>
<tag>
Expand Down Expand Up @@ -537,13 +579,13 @@
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.11.3</version>
<version>1.21</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.11.3</version>
<version>1.21</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -556,6 +598,12 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
Expand Down Expand Up @@ -677,12 +725,12 @@
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.5</version>
<version>1.5.6</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>1.5.0-alpha.14</version>
<version>1.5.0-alpha.16</version>
</dependency>
</dependencies>
<executions>
Expand All @@ -697,7 +745,6 @@
<backend>html5</backend>
<outputDirectory>${project.build.directory}/site/reference/html
</outputDirectory>
<sectids>false</sectids>
<doctype>book</doctype>
<attributes>
<linkcss>true</linkcss>
Expand Down Expand Up @@ -743,7 +790,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
<executions>
<execution>
<id>docs</id>
Expand Down Expand Up @@ -781,7 +828,7 @@
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
<version>1.6.0</version>
</extension>
</extensions>

Expand All @@ -790,7 +837,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<version>3.8.0</version>
<configuration>
<compilerArgument>-Xlint:all,-deprecation,-unchecked</compilerArgument>
<testCompilerArgument>-Xlint:none</testCompilerArgument>
Expand All @@ -804,19 +851,61 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<version>2.22.0</version>
<configuration>
<systemProperties>
<io.netty.eventLoopThreads>4</io.netty.eventLoopThreads>
</systemProperties>
<includes>
<include>**/*UnitTests</include>
<include>**/*Tests</include>
</includes>
<excludes>
<exclude>**/*Test</exclude>
<exclude>**/*IntegrationTests</exclude>
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<systemProperties>
<io.netty.eventLoopThreads>4</io.netty.eventLoopThreads>
</systemProperties>
<includes>
<include>**/*IntegrationTests</include>
<include>**/*Test</include>
</includes>
<excludes>
<exclude>**/*UnitTests</exclude>
</excludes>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.20</version>
<artifactId>surefire-junit-platform</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>

<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,46 @@

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import io.lettuce.core.FastShutdown;
import io.lettuce.core.RedisURI;
import io.lettuce.core.TestSettings;
import io.lettuce.core.api.sync.RedisCommands;
import io.lettuce.core.pubsub.RedisPubSubAsyncCommandsImpl;
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
import io.lettuce.core.pubsub.api.async.RedisPubSubAsyncCommands;
import io.lettuce.test.resource.FastShutdown;
import io.lettuce.test.settings.TestSettings;

/**
* Test for override/extensability of RedisClient
*/
public class MyExtendedRedisClientTest {
public static final String host = TestSettings.host();
public static final int port = TestSettings.port();
class MyExtendedRedisClientTest {
private static final String host = TestSettings.host();
private static final int port = TestSettings.port();

protected static MyExtendedRedisClient client;
private static MyExtendedRedisClient client;
protected RedisCommands<String, String> redis;
protected String key = "key";
protected String value = "value";

@BeforeClass
public static void setupClient() {
@BeforeAll
static void setupClient() {
client = getRedisClient();
}

protected static MyExtendedRedisClient getRedisClient() {
static MyExtendedRedisClient getRedisClient() {
return new MyExtendedRedisClient(null, RedisURI.create(host, port));
}

@AfterClass
public static void shutdownClient() {
@AfterAll
static void shutdownClient() {
FastShutdown.shutdown(client);
}

@Test
public void testPubsub() throws Exception {
void testPubsub() throws Exception {
StatefulRedisPubSubConnection<String, String> connection = client
.connectPubSub();
RedisPubSubAsyncCommands<String, String> commands = connection.async();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @author Mark Paluch
*/
@SuppressWarnings("unchecked")
public class MyPubSubConnection<K, V> extends StatefulRedisPubSubConnectionImpl<K, V> {
class MyPubSubConnection<K, V> extends StatefulRedisPubSubConnectionImpl<K, V> {

private AtomicInteger subscriptions = new AtomicInteger();

Expand Down
Loading

0 comments on commit 36ff55c

Please sign in to comment.