|
@@ -1,2 +1,30 @@
|
|
|
-package PACKAGE_NAME;public class FileConverterTest {
|
|
|
|
|
|
|
+import org.junit.jupiter.api.AfterAll;
|
|
|
|
|
+import org.junit.jupiter.api.Test;
|
|
|
|
|
+
|
|
|
|
|
+import java.io.*;
|
|
|
|
|
+
|
|
|
|
|
+import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
|
+
|
|
|
|
|
+public class FileConverterTest {
|
|
|
|
|
+ public static final String path_to_test_files = "C:\\Users\\piotr\\Documents\\Studia\\IiTA - 8zd\\konwersja-liter\\untitled\\src\\main\\resources\\";
|
|
|
|
|
+
|
|
|
|
|
+ private String basicTest(String file_name) throws IOException {
|
|
|
|
|
+ String basic = "abcdfg";
|
|
|
|
|
+ String path = path_to_test_files + file_name;
|
|
|
|
|
+ String content = FileConverter.readFile(path);
|
|
|
|
|
+ assertEquals(basic,content);
|
|
|
|
|
+ return content;
|
|
|
|
|
+ }
|
|
|
|
|
+ @Test
|
|
|
|
|
+ void testOnlyCharacters() throws IOException {
|
|
|
|
|
+ String content = basicTest("file.txt");
|
|
|
|
|
+ checkUpperCase(content);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void checkUpperCase (String content) throws IOException {
|
|
|
|
|
+ String basic = "ABCDFG";
|
|
|
|
|
+ assertEquals(basic,FileConverter.toUpperCase(content));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|