Fix tests

This commit is contained in:
Andrea Cavalli 2023-05-22 23:31:11 +02:00
parent 77894edce9
commit 70f83caf1d
1 changed files with 12 additions and 9 deletions

View File

@ -1,19 +1,22 @@
package it.cavallium.stream; package it.cavallium.stream;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import it.cavallium.buffer.Buf; import it.cavallium.buffer.Buf;
import it.cavallium.buffer.BufDataInput; import it.cavallium.buffer.BufDataInput;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
@SuppressWarnings("resource") @SuppressWarnings("resource")
public class TestInput { public class TestInput {
@ -32,11 +35,11 @@ public class TestInput {
@Test @Test
public void testBufDataInputValidity() { public void testBufDataInputValidity() {
var bdi = BufDataInput.create(Buf.wrap((byte) 1, (byte) 2, (byte) 3, (byte) 4)); var bdi = BufDataInput.create(Buf.wrap((byte) 1, (byte) 2, (byte) 3, (byte) 4));
assertThrows(UnsupportedOperationException.class, () -> bdi.mark(1)); assertDoesNotThrow(() -> bdi.mark(1));
assertThrows(UnsupportedOperationException.class, bdi::reset); assertDoesNotThrow(bdi::reset);
//noinspection deprecation //noinspection deprecation
assertDoesNotThrow(bdi::close); assertDoesNotThrow(bdi::close);
assertFalse(bdi.markSupported()); assertTrue(bdi.markSupported());
} }
@Test @Test