View Javadoc
1   package edu.jiangxin.common;
2   
3   import java.io.File;
4   
5   import org.junit.jupiter.api.Test;
6   
7   import edu.jiangxin.apktoolbox.file.core.OsPatternConvert;
8   
9   import static org.junit.jupiter.api.Assertions.assertTrue;
10  
11  /**
12   * @author jiangxin
13   * @author 2018-09-09
14   *
15   */
16  public class OsPatternConvertTest {
17  
18      String path = "target/test-classes/OSPatternConvertTest/";
19  
20      @Test
21      public void testXxx2Xxx() {
22          assertTrue(new File(path + "test.txt").exists());
23          OsPatternConvert.dos2Unix(path + "test.txt", path + "unix.txt");
24          assertTrue(new File(path + "unix.txt").exists());
25          OsPatternConvert.dos2Mac(path + "test.txt", path + "mac.txt");
26          assertTrue(new File(path + "mac.txt").exists());
27          OsPatternConvert.unix2Dos(path + "unix.txt", path + "dos.txt");
28          assertTrue(new File(path + "dos.txt").exists());
29      }
30  
31      @Test
32      public void testOsDirConvert() {
33          assertTrue(new File(path + "test").exists());
34          OsPatternConvert.osDirConvert(path + "test", path + "dos", "toDoS");
35          assertTrue(new File(path + "dos").exists());
36          OsPatternConvert.osDirConvert(path + "test", path + "unix", "dos2unix");
37          assertTrue(new File(path + "unix").exists());
38          OsPatternConvert.osDirConvert(path + "test", path + "mac", "dostomAC");
39          assertTrue(new File(path + "mac").exists());
40          OsPatternConvert.osDirConvert(path + "test", path + "linux", "toLinux");
41          assertTrue(new File(path + "linux").exists());
42      }
43  
44  }