From 85dc38592f9b61a8cc620dc14eae3797344ed234 Mon Sep 17 00:00:00 2001 From: Tristan Chuine Date: Mon, 23 Sep 2024 15:12:17 +0200 Subject: [PATCH] Migrate tests to Junit5 Signed-off-by: Tristan Chuine --- pom.xml | 5 ----- .../powsybl/ws/commons/SecuredZipInputStreamTest.java | 10 +++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index f5cba19..6c758ab 100644 --- a/pom.xml +++ b/pom.xml @@ -141,11 +141,6 @@ - - org.junit.vintage - junit-vintage-engine - test - org.slf4j slf4j-simple diff --git a/src/test/java/com/powsybl/ws/commons/SecuredZipInputStreamTest.java b/src/test/java/com/powsybl/ws/commons/SecuredZipInputStreamTest.java index 0bbea2a..58a4256 100644 --- a/src/test/java/com/powsybl/ws/commons/SecuredZipInputStreamTest.java +++ b/src/test/java/com/powsybl/ws/commons/SecuredZipInputStreamTest.java @@ -7,7 +7,7 @@ package com.powsybl.ws.commons; import com.google.common.io.ByteStreams; -import org.junit.Test; +import org.junit.jupiter.api.Test; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -15,14 +15,14 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; /** * @author Etienne Homer */ -public class SecuredZipInputStreamTest { +class SecuredZipInputStreamTest { @Test - public void test() throws IOException { + void test() throws IOException { byte[] fileContent = ByteStreams.toByteArray(Objects.requireNonNull(getClass().getResourceAsStream("/MicroGridTestConfiguration_T4_BE_BB_Complete_v2.zip"))); try (SecuredZipInputStream tooManyEntriesSecuredZis = new SecuredZipInputStream(new ByteArrayInputStream(fileContent), 3, 1000000000)) { assertTrue(assertThrows(IllegalStateException.class, () -> readZip(tooManyEntriesSecuredZis)) @@ -40,7 +40,7 @@ public void test() throws IOException { } } - public int readZip(ZipInputStream zis) throws IOException { + private static int readZip(ZipInputStream zis) throws IOException { ZipEntry entry = zis.getNextEntry(); int readBytes = 0; while (entry != null) {