-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathFileEncodingTest.java
More file actions
36 lines (28 loc) · 1.03 KB
/
FileEncodingTest.java
File metadata and controls
36 lines (28 loc) · 1.03 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
package org.javacs;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import java.nio.file.Paths;
import java.util.Set;
import org.junit.Test;
import org.junit.Before;
/**
* These tests are isolated because bugs caused by encoding issues could cause
* phantom failures in other tests.
*/
public class FileEncodingTest {
@Before
public void resetSourcesBefore() {
FileStore.reset();
}
@Test
public void packageNameForNonUnicodeSource() {
var encodingTestRoot = Paths.get("src/test/examples/encoding").normalize();
// If an exception is thrown due to an unknown encoding it would
// be here.
FileStore.setWorkspaceRoots(Set.of(encodingTestRoot));
var file = FindResource.path("/org/javacs/example/EncodingWindows1252.java");
// Currently, non-unicode files are ignored. This test will change if
// support is added in the future.
assertThat(FileStore.suggestedPackageName(file), equalTo(""));
}
}