Merge pull request #10686 from zzzeebra/Jave4to5-msa

JUnit5 migration in msa.
This commit is contained in:
Andrew Shvayka 2024-05-13 12:16:40 +03:00 committed by GitHub
commit 1f5ef423cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 14 deletions

View File

@ -43,6 +43,11 @@
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>software.xdev</groupId>
<artifactId>testcontainers-junit4-mock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.zeroturnaround</groupId>
<artifactId>zt-exec</artifactId>
@ -63,11 +68,6 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>

View File

@ -19,7 +19,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.eclipse.leshan.client.object.Security;
import org.eclipse.leshan.core.util.Hex;
import org.junit.Assert;
import org.thingsboard.common.util.JacksonUtil;
import org.thingsboard.common.util.ThingsBoardThreadFactory;
import org.thingsboard.server.common.data.Device;
@ -141,7 +140,7 @@ public class AbstractLwm2mClientTest extends AbstractContainerTest{
log.warn("msa basicTestConnection update -> finishState: [{}] states: {}", finishState, lwM2MTestClient.getClientStates());
return lwM2MTestClient.getClientStates().contains(finishState) || lwM2MTestClient.getClientStates().contains(ON_UPDATE_SUCCESS);
});
Assert.assertTrue(lwM2MTestClient.getClientStates().containsAll(expectedStatusesRegistrationLwm2mSuccess));
assertThat(lwM2MTestClient.getClientStates()).containsAll(expectedStatusesRegistrationLwm2mSuccess);
}
public LwM2MTestClient createNewClient(Security security,

View File

@ -50,7 +50,6 @@ import org.eclipse.leshan.core.request.BootstrapRequest;
import org.eclipse.leshan.core.request.DeregisterRequest;
import org.eclipse.leshan.core.request.RegisterRequest;
import org.eclipse.leshan.core.request.UpdateRequest;
import org.junit.Assert;
import org.thingsboard.server.msa.connectivity.lwm2m.Lwm2mTestHelper.LwM2MClientState;
import java.io.IOException;
@ -63,6 +62,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.californium.scandium.config.DtlsConfig.DTLS_CONNECTION_ID_LENGTH;
import static org.eclipse.californium.scandium.config.DtlsConfig.DTLS_RECOMMENDED_CIPHER_SUITES_ONLY;
import static org.eclipse.leshan.core.LwM2mId.ACCESS_CONTROL;
@ -107,7 +107,7 @@ public class LwM2MTestClient {
private Map<LwM2MClientState, Integer> clientDtlsCid;
public void init(Security security, int clientPort) throws InvalidDDFFileException, IOException {
Assert.assertNull("client already initialized", leshanClient);
assertThat(leshanClient).as("client already initialized").isNull();
List<ObjectModel> models = new ArrayList<>();
for (String resourceName : resources) {

View File

@ -75,11 +75,6 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>

View File

@ -148,6 +148,7 @@
<rest-assured.version>5.4.0</rest-assured.version>
<hamcrest.version>2.2</hamcrest.version>
<testcontainers.version>1.19.7</testcontainers.version>
<testcontainers-junit4-mock.version>1.0.1</testcontainers-junit4-mock.version>
<zeroturnaround.version>1.12</zeroturnaround.version>
<selenium.version>4.19.1</selenium.version>
<webdrivermanager.version>5.8.0</webdrivermanager.version>
@ -2153,6 +2154,14 @@
</exclusion>
</exclusions>
</dependency>
<!-- Mocks the few JUnit 4 classes that testcontainers needs so that JUnit 4 can be excluded.
Fixes/Works around https://github.com/testcontainers/testcontainers-java/issues/970 -->
<dependency>
<groupId>software.xdev</groupId>
<artifactId>testcontainers-junit4-mock</artifactId>
<version>${testcontainers-junit4-mock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.zeroturnaround</groupId>
<artifactId>zt-exec</artifactId>