mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-09-20 23:14:39 +00:00
Add readme file to vault storage directory
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package org.cryptomator.ui.addvaultwizard;
|
||||
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.hamcrest.MatcherAssert;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.CsvSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ReadMeGeneratorTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({ //
|
||||
"test,test", //
|
||||
"t\u00E4st,t\\u228st", //
|
||||
"t\uD83D\uDE09st,t\\u55357\\u56841st", //
|
||||
})
|
||||
public void testEscapeNonAsciiChars(String input, String expectedResult) {
|
||||
ReadmeGenerator readmeGenerator = new ReadmeGenerator(null);
|
||||
|
||||
String actualResult = readmeGenerator.escapeNonAsciiChars(input);
|
||||
|
||||
Assertions.assertEquals(expectedResult, actualResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateDocument() {
|
||||
ReadmeGenerator readmeGenerator = new ReadmeGenerator(null);
|
||||
Iterable<String> paragraphs = List.of( //
|
||||
"Dear User,", //
|
||||
"\\b please don't touch the \"d\" directory.", //
|
||||
"Thank you for your cooperation \uD83D\uDE09" //
|
||||
);
|
||||
|
||||
String result = readmeGenerator.createDocument(paragraphs);
|
||||
|
||||
MatcherAssert.assertThat(result, CoreMatchers.startsWith("{\\rtf1\\fbidis\\ansi\\uc0\\fs32"));
|
||||
MatcherAssert.assertThat(result, CoreMatchers.containsString("\\par {\\sa80 Dear User,}"));
|
||||
MatcherAssert.assertThat(result, CoreMatchers.containsString("\\par {\\sa80 \\b please don't touch the \"d\" directory.}"));
|
||||
MatcherAssert.assertThat(result, CoreMatchers.containsString("\\par {\\sa80 Thank you for your cooperation \\u55357\\u56841}"));
|
||||
MatcherAssert.assertThat(result, CoreMatchers.endsWith("}"));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user