use of org.junit.jupiter.api.condition.DisabledOnOs in project jspwiki by apache.
the class FileUtilTest method testReadContentsFromPipeOnLinux.
/**
* ISO Latin 1 from a pipe.
*/
@Test
@DisabledOnOs(OS.WINDOWS)
public void testReadContentsFromPipeOnLinux() throws Exception {
String src = "abc\n123456\n\nfoobar.\n";
// Make a very long string.
for (int i = 0; i < 10; i++) {
src += src;
}
src += "\u00e4\u00e5\u00a6";
final File f = FileUtil.newTmpFile(src, StandardCharsets.ISO_8859_1);
final String[] envp = {};
final Process process = Runtime.getRuntime().exec("cat " + f.getAbsolutePath(), envp, f.getParentFile());
final String result = FileUtil.readContents(process.getInputStream(), StandardCharsets.UTF_8.name());
f.delete();
Assertions.assertEquals(src, result);
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project robozonky by RoboZonky.
the class FileUtilTest method permissions.
@DisabledOnOs(OS.WINDOWS)
@Test
void permissions() throws IOException {
File file = createTempFile();
Path path = file.toPath();
boolean result = FileUtil.configurePermissions(file, true);
assertSoftly(softly -> {
softly.assertThat(path.toFile()).canRead().canWrite();
softly.assertThat(path.toFile().canExecute()).isTrue();
softly.assertThat(result).isTrue();
});
boolean result2 = FileUtil.configurePermissions(file, false);
assertSoftly(softly -> {
softly.assertThat(path.toFile()).canRead().canWrite();
softly.assertThat(path.toFile().canExecute()).isFalse();
softly.assertThat(result2).isTrue();
});
}
Aggregations