Feature/remove junit5 leftovers (#1097)

* Migrate JUnit4 leftovers to JUnit5

Signed-off-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch.io>

* Fix method name typos

Signed-off-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch.io>

* Avoid unnecessary Mockito stubbings

Signed-off-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch.io>

* Replace assertThrows by assertThatExceptionOfType, fix test TODO

Signed-off-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch.io>
This commit is contained in:
Florian Ruschbaschan
2021-03-22 10:37:31 +01:00
committed by GitHub
parent 84740a2b1c
commit 41922b6dca
30 changed files with 325 additions and 327 deletions

View File

@@ -9,7 +9,7 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.hawkbit</groupId>
@@ -48,19 +48,19 @@
<artifactId>mariadb-java-client</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- Add a JDBC DB2 compatabile driver if you want to run tests against DB2, e.g. -->
<!-- <dependency> -->
<!-- <groupId>com.ibm.db2.jcc</groupId> -->
<!-- <artifactId>db2jcc4</artifactId> -->
<!-- <version>11.1.2.2</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>com.ibm.db2.jcc</groupId> -->
<!-- <artifactId>db2jcc4</artifactId> -->
<!-- <version>11.1.2.2</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
@@ -76,7 +76,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
@@ -88,7 +88,7 @@
<dependency>
<groupId>net._01001111</groupId>
<artifactId>jlorem</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
@@ -116,6 +116,12 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-test</artifactId>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository.test.matcher;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.fail;
import java.lang.reflect.Method;
import java.util.Iterator;
@@ -20,10 +21,11 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
import org.eclipse.hawkbit.repository.event.remote.RemoteIdEvent;
import org.eclipse.hawkbit.repository.event.remote.RemoteTenantAwareEvent;
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
@@ -37,8 +39,6 @@ import org.springframework.test.context.support.AbstractTestExecutionListener;
import com.google.common.collect.ConcurrentHashMultiset;
import com.google.common.collect.Multiset;
import com.google.common.collect.Sets;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
/**
* Test rule to setup and verify the event count for a method.
@@ -107,7 +107,7 @@ public class EventVerifier extends AbstractTestExecutionListener {
.until(() -> eventCaptor.getCountFor(expectedEvent.type()), equalTo(expectedEvent.count()));
} catch (final ConditionTimeoutException ex) {
Assert.fail("Did not receive the expected amount of events form " + expectedEvent.type() + " Expected: "
fail("Did not receive the expected amount of events form " + expectedEvent.type() + " Expected: "
+ expectedEvent.count() + " but was: " + eventCaptor.getCountFor(expectedEvent.type()));
}
}
@@ -124,7 +124,7 @@ public class EventVerifier extends AbstractTestExecutionListener {
final int count = eventCaptor.getCountFor(element);
failMessage.append(element + " with count: " + count + " ");
}
Assert.fail(failMessage.toString());
fail(failMessage.toString());
}
}