diff --git a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/LinuxErrnoTest.java b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/LinuxErrnoTest.java index 34cb8b02..56d77b3e 100644 --- a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/LinuxErrnoTest.java +++ b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/LinuxErrnoTest.java @@ -1,16 +1,22 @@ package org.cryptomator.jfuse.linux.aarch64; +import org.cryptomator.jfuse.api.Errno; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.stream.Stream; + public class LinuxErrnoTest { - @DisplayName("make sure method is not a stub") + @DisplayName("make sure no errno method is not a stub") @ParameterizedTest(name = "{0}()") - @ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"}) - public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationException { + @MethodSource("errnoNameProvider") + public void testErrnoIsImplemented(String methodName) throws ReflectiveOperationException { var errno = new LinuxErrno(); var method = LinuxErrno.class.getMethod(methodName); @@ -19,4 +25,8 @@ public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationExce Assertions.assertNotEquals(0, result); } + static Stream errnoNameProvider() { + return Arrays.stream(Errno.class.getDeclaredMethods()).map(Method::getName); + } + } \ No newline at end of file diff --git a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/LinuxErrnoTest.java b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/LinuxErrnoTest.java index e7980c46..1da3d979 100644 --- a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/LinuxErrnoTest.java +++ b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/LinuxErrnoTest.java @@ -1,16 +1,22 @@ package org.cryptomator.jfuse.linux.amd64; +import org.cryptomator.jfuse.api.Errno; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.stream.Stream; + public class LinuxErrnoTest { - @DisplayName("make sure method is not a stub") + @DisplayName("make sure no errno method is not a stub") @ParameterizedTest(name = "{0}()") - @ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"}) - public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationException { + @MethodSource("errnoNameProvider") + public void testErrnoIsImplemented(String methodName) throws ReflectiveOperationException { var errno = new LinuxErrno(); var method = LinuxErrno.class.getMethod(methodName); @@ -19,4 +25,8 @@ public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationExce Assertions.assertNotEquals(0, result); } + static Stream errnoNameProvider() { + return Arrays.stream(Errno.class.getDeclaredMethods()).map(Method::getName); + } + } \ No newline at end of file