Skip to content

Commit 8012d53

Browse files
committed
fix test
1 parent 017ee6d commit 8012d53

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/test/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccessTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import org.junit.jupiter.api.Assertions;
44
import org.junit.jupiter.api.BeforeAll;
55
import org.junit.jupiter.api.Test;
6-
import org.junit.jupiter.api.condition.EnabledOnOs;
7-
import org.junit.jupiter.api.condition.OS;
6+
import org.junit.jupiter.api.condition.EnabledIf;
87

98
import java.io.IOException;
109
import java.util.List;
@@ -13,14 +12,13 @@
1312
/**
1413
* Unit tests for GNOME keyring access via DBUS.
1514
*/
16-
@EnabledOnOs(OS.LINUX)
1715
public class SecretServiceKeychainAccessTest {
1816

1917
private static boolean isInstalled;
2018

2119
@BeforeAll
2220
public static void checkSystemAndSetup() throws IOException {
23-
ProcessBuilder dbusSend = new ProcessBuilder("dbus-send","--print-reply","--dest=org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus.ListNames");
21+
ProcessBuilder dbusSend = new ProcessBuilder("dbus-send", "--print-reply", "--dest=org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus.ListNames");
2422
ProcessBuilder grep = new ProcessBuilder("grep", "org.gnome.keyring");
2523
try {
2624
Process end = ProcessBuilder.startPipeline(List.of(dbusSend, grep)).get(1);
@@ -36,10 +34,13 @@ public static void checkSystemAndSetup() throws IOException {
3634

3735

3836
@Test
39-
public void testIsSupported(){
37+
@EnabledIf("isXdgDisplayEnvVarSet")
38+
public void testIsSupported() {
4039
SecretServiceKeychainAccess secretService = new SecretServiceKeychainAccess();
4140
Assertions.assertEquals(isInstalled, secretService.isSupported());
4241
}
4342

44-
45-
}
43+
public boolean isXdgDisplayEnvVarSet() {
44+
return System.getenv("DISPLAY") != null;
45+
}
46+
}

0 commit comments

Comments
 (0)