diff options
Diffstat (limited to 'vespajlib/src/test/java')
-rw-r--r-- | vespajlib/src/test/java/com/yahoo/io/NativeIOTestCase.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/io/NativeIOTestCase.java b/vespajlib/src/test/java/com/yahoo/io/NativeIOTestCase.java new file mode 100644 index 00000000000..91144d5999f --- /dev/null +++ b/vespajlib/src/test/java/com/yahoo/io/NativeIOTestCase.java @@ -0,0 +1,35 @@ +package com.yahoo.io; + +import com.sun.jna.Platform; +import org.junit.Test; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + + +public class NativeIOTestCase { + + @Test + public void requireThatDropFileFromCacheDoesNotThrow() throws IOException { + File testFile = new File("testfile"); + FileOutputStream output = new FileOutputStream(testFile); + output.write('t'); + output.flush(); + output.close(); + try { + NativeIO nativeIO = new NativeIO(); + nativeIO.dropFileFromCache(output.getFD()); + nativeIO.dropFileFromCache(testFile); + } catch (Throwable e) { + if (Platform.isLinux()) { + assertTrue(false); + } else { + assertEquals("Platform is unsúpported. Only supported on linux.", e.getMessage()); + } + } + } +} |