/
rgd045
/
crypt-file
Обзор
Документация
Войти
/
rgd045
/
crypt-file
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/test/java/org/cryptomator/ipc/RevealRunningAppMessageTest.java
30 строк
888 B
Sebastian Stenzel
Use UNIX Sockets for IPC
13 июл 2021, 19:18
Не верифицирован
13 июл 2021, 19:18
755eb70
Код
Авторство
О чём код?
package org.cryptomator.ipc; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import java.io.IOException; import java.nio.channels.FileChannel; import java.nio.file.Path; import java.nio.file.StandardOpenOption; import java.util.List; public class RevealRunningAppMessageTest { @Test public void testSendAndReceive(@TempDir Path tmpDir) throws IOException { var message = new RevealRunningAppMessage(); var file = tmpDir.resolve("tmp.file"); try (var ch = FileChannel.open(file, StandardOpenOption.CREATE_NEW, StandardOpenOption.READ, StandardOpenOption.WRITE)) { message.send(ch); ch.position(0); if (IpcMessage.receive(ch) instanceof RevealRunningAppMessage received) { Assertions.assertNotNull(received); } else { Assertions.fail("Received message of unexpected class"); } } } }