mirror of
https://github.com/cryptomator/cryptomator.git
synced 2024-11-23 12:09:45 +00:00
made tests public to avoid reflection and "open modules"
see also https://issues.apache.org/jira/browse/SUREFIRE-1909
This commit is contained in:
parent
f9545b5532
commit
f10d2b713b
@ -99,12 +99,12 @@ public class Environment {
|
||||
}
|
||||
|
||||
// visible for testing
|
||||
Path getHomeDir() {
|
||||
public Path getHomeDir() {
|
||||
return getPath("user.home").orElseThrow();
|
||||
}
|
||||
|
||||
// visible for testing
|
||||
Stream<Path> getPaths(String propertyName) {
|
||||
public Stream<Path> getPaths(String propertyName) {
|
||||
Stream<String> rawSettingsPaths = getRawList(propertyName, PATH_LIST_SEP);
|
||||
return rawSettingsPaths.filter(Predicate.not(Strings::isNullOrEmpty)).map(Paths::get).map(this::replaceHomeDir);
|
||||
}
|
||||
|
@ -17,12 +17,12 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@DisplayName("Environment Variables Test")
|
||||
class EnvironmentTest {
|
||||
public class EnvironmentTest {
|
||||
|
||||
private Environment env;
|
||||
|
||||
@BeforeEach
|
||||
void init() {
|
||||
public void init() {
|
||||
env = Mockito.spy(new Environment());
|
||||
Mockito.when(env.getHomeDir()).thenReturn(Path.of("/home/testuser"));
|
||||
}
|
||||
@ -82,7 +82,7 @@ class EnvironmentTest {
|
||||
|
||||
@Nested
|
||||
@DisplayName("Path Lists")
|
||||
class SettingsPath {
|
||||
public class SettingsPath {
|
||||
|
||||
@Test
|
||||
@DisplayName("test.path.property=")
|
||||
|
@ -7,7 +7,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
class LicenseCheckerTest {
|
||||
public class LicenseCheckerTest {
|
||||
|
||||
private static final String PUBLIC_KEY = """
|
||||
MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBgc4HZz+/fBbC7lmEww0AO3NK9wVZ\
|
||||
|
@ -12,12 +12,12 @@ import java.awt.GraphicsEnvironment;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
class SecurePasswordFieldTest {
|
||||
public class SecurePasswordFieldTest {
|
||||
|
||||
private SecurePasswordField pwField = new SecurePasswordField();
|
||||
|
||||
@BeforeAll
|
||||
static void initJavaFx() throws InterruptedException {
|
||||
public static void initJavaFx() throws InterruptedException {
|
||||
Assumptions.assumeFalse(GraphicsEnvironment.isHeadless());
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
Platform.startup(latch::countDown);
|
||||
@ -29,7 +29,7 @@ class SecurePasswordFieldTest {
|
||||
|
||||
@Nested
|
||||
@DisplayName("Content Update Events")
|
||||
class TextChange {
|
||||
public class TextChange {
|
||||
|
||||
@Test
|
||||
@DisplayName("\"ant\".append(\"eater\")")
|
||||
|
@ -10,7 +10,7 @@ import org.junit.jupiter.params.provider.ValueSource;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
class AutoCompleterTest {
|
||||
public class AutoCompleterTest {
|
||||
|
||||
@Test
|
||||
@DisplayName("no match in []")
|
||||
@ -30,7 +30,7 @@ class AutoCompleterTest {
|
||||
|
||||
@Nested
|
||||
@DisplayName("search in dict: ['tame', 'teach', 'teacher']")
|
||||
class NarrowedDownDict {
|
||||
public class NarrowedDownDict {
|
||||
|
||||
AutoCompleter autoCompleter = new AutoCompleter(Set.of("tame", "teach", "teacher"));
|
||||
|
||||
|
@ -13,7 +13,7 @@ import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
class RecoveryKeyFactoryTest {
|
||||
public class RecoveryKeyFactoryTest {
|
||||
|
||||
private WordEncoder wordEncoder = new WordEncoder();
|
||||
private MasterkeyFileAccess masterkeyFileAccess = Mockito.mock(MasterkeyFileAccess.class);
|
||||
|
@ -12,7 +12,7 @@ import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
class WordEncoderTest {
|
||||
public class WordEncoderTest {
|
||||
|
||||
private static final Random PRNG = new Random(42l);
|
||||
private WordEncoder encoder;
|
||||
@ -25,13 +25,13 @@ class WordEncoderTest {
|
||||
@DisplayName("decode(encode(input)) == input")
|
||||
@ParameterizedTest(name = "test {index}")
|
||||
@MethodSource("createRandomByteSequences")
|
||||
void encodeAndDecode(byte[] input) {
|
||||
public void encodeAndDecode(byte[] input) {
|
||||
String encoded = encoder.encodePadded(input);
|
||||
byte[] decoded = encoder.decode(encoded);
|
||||
Assertions.assertArrayEquals(input, decoded);
|
||||
}
|
||||
|
||||
static Stream<byte[]> createRandomByteSequences() {
|
||||
public static Stream<byte[]> createRandomByteSequences() {
|
||||
return IntStream.range(0, 30).mapToObj(i -> {
|
||||
byte[] randomBytes = new byte[i * 3];
|
||||
PRNG.nextBytes(randomBytes);
|
||||
|
Loading…
Reference in New Issue
Block a user