Skip to content

Commit

Permalink
Migrate tests to Junit5
Browse files Browse the repository at this point in the history
Signed-off-by: Tristan Chuine <tristan.chuine_externe@rte-france.com>
  • Loading branch information
Tristan-WorkGH committed Sep 24, 2024
1 parent 685f849 commit 85dc385
Showing 2 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -141,11 +141,6 @@
</dependency>

<!-- test -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Original file line number Diff line number Diff line change
@@ -7,22 +7,22 @@
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;
import java.util.Objects;
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 <etienne.homer at rte-france.com>
*/
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) {

0 comments on commit 85dc385

Please sign in to comment.