Merge branch 'develop' into feature/integrations-api-1.1.0

# Conflicts:
#	src/main/java/org/cryptomator/ui/fxapp/FxApplication.java
#	src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java
This commit is contained in:
Sebastian Stenzel
2022-04-13 07:21:59 +02:00
24 changed files with 389 additions and 198 deletions
@@ -22,7 +22,6 @@ public class PasswordStrengthUtilTest {
}
@Test
@Disabled("waiting on upstream fix") // https://github.com/nulab/zxcvbn4j/issues/54
public void testIssue979() {
PasswordStrengthUtil util = new PasswordStrengthUtil(Mockito.mock(ResourceBundle.class), Mockito.mock(Environment.class));
int result1 = util.computeRate("backed derrick buckling mountains glove client procedures desire destination sword hidden ram");
@@ -7,10 +7,13 @@ import org.cryptomator.cryptolib.common.MasterkeyFileAccess;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.Mockito;
import java.io.IOException;
import java.nio.file.Path;
import java.util.function.Predicate;
public class RecoveryKeyFactoryTest {
@@ -75,4 +78,19 @@ public class RecoveryKeyFactoryTest {
Assertions.assertTrue(result);
}
@ParameterizedTest(name = "passing validation = {0}")
@DisplayName("validateRecoveryKey() with extended validation")
@ValueSource(booleans = {true, false})
public void testValidateValidateRecoveryKeyWithValidKey(boolean extendedValidationResult) {
Predicate<byte[]> validator = Mockito.mock(Predicate.class);
Mockito.doReturn(extendedValidationResult).when(validator).test(Mockito.any());
boolean result = inTest.validateRecoveryKey("""
pathway lift abuse plenty export texture gentleman landscape beyond ceiling around leaf cafe charity \
border breakdown victory surely computer cat linger restrict infer crowd live computer true written amazed \
investor boot depth left theory snow whereby terminal weekly reject happiness circuit partial cup ad \
""", validator);
Mockito.verify(validator).test(Mockito.any());
Assertions.assertEquals(extendedValidationResult, result);
}
}