-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTestFileTest.java
More file actions
42 lines (37 loc) · 1.31 KB
/
TestFileTest.java
File metadata and controls
42 lines (37 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package edu.rit.se.testsmelss;
import edu.rit.se.testsmells.TestFile;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import static org.junit.jupiter.api.Assertions.*;
public class TestFileTest {
String fname;
TestFile sut;
@Test
@EnabledOnOs({OS.WINDOWS})
void splitFilepath() {
fname = "C:\\textfiles\\db\\query\\query.txt";
sut = new TestFile(fname);
String[] splitted = sut.splitFilepath(fname);
assertEquals(5, splitted.length);
assertEquals("C:", splitted[0]);
assertEquals("textfiles", splitted[1]);
assertEquals("db", splitted[2]);
assertEquals("query", splitted[3]);
assertEquals("query.txt", splitted[4]);
}
@Test
@EnabledOnOs({OS.LINUX})
void splitUNIXFilepath() {
fname = "relativePath/textfiles/db/query/query.txt";
sut = new TestFile(fname);
String[] splitted = sut.splitFilepath(fname);
assertEquals(5, splitted.length);
assertEquals("relativePath", splitted[0]);
assertEquals("textfiles", splitted[1]);
assertEquals("db", splitted[2]);
assertEquals("query", splitted[3]);
assertEquals("query.txt", splitted[4]);
}
}