Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate tests to Junit5 #68

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Loading