|
1 | | -package org.javacs; |
2 | | - |
3 | | -import static org.hamcrest.Matchers.equalTo; |
4 | | -import static org.junit.Assert.assertThat; |
5 | | - |
6 | | -import java.nio.file.Paths; |
7 | | -import java.util.Set; |
8 | | -import org.junit.Test; |
9 | | -import org.junit.Before; |
10 | | - |
11 | | -/** |
12 | | - * These tests are isolated because bugs caused by encoding issues could cause |
13 | | - * phantom failures in other tests. |
14 | | - */ |
15 | | -public class FileEncodingTest { |
16 | | - |
17 | | - @Before |
18 | | - public void resetSourcesBefore() { |
19 | | - FileStore.reset(); |
20 | | - } |
21 | | - |
22 | | - @Test |
23 | | - public void packageNameForNonUnicodeSource() { |
24 | | - var encodingTestRoot = Paths.get("src/test/examples/encoding").normalize(); |
25 | | - |
26 | | - // If an exception is thrown due to an unknown encoding it would |
27 | | - // be here. |
28 | | - FileStore.setWorkspaceRoots(Set.of(encodingTestRoot)); |
29 | | - |
30 | | - var file = FindResource.path("/org/javacs/example/EncodingWindows1252.java"); |
31 | | - |
32 | | - // Currently, non-unicode files are ignored. This test will change if |
33 | | - // support is added in the future. |
34 | | - assertThat(FileStore.suggestedPackageName(file), equalTo("")); |
35 | | - } |
36 | | -} |
| 1 | +package org.javacs; |
| 2 | + |
| 3 | +import static org.hamcrest.Matchers.equalTo; |
| 4 | +import static org.hamcrest.MatcherAssert.assertThat; |
| 5 | + |
| 6 | +import java.nio.file.Paths; |
| 7 | +import java.util.Set; |
| 8 | +import org.junit.Test; |
| 9 | +import org.junit.Before; |
| 10 | + |
| 11 | +/** |
| 12 | + * These tests are isolated because bugs caused by encoding issues could cause |
| 13 | + * phantom failures in other tests. |
| 14 | + */ |
| 15 | +public class FileEncodingTest { |
| 16 | + |
| 17 | + @Before |
| 18 | + public void resetSourcesBefore() { |
| 19 | + FileStore.reset(); |
| 20 | + } |
| 21 | + |
| 22 | + @Test |
| 23 | + public void packageNameForNonUnicodeSource() { |
| 24 | + var encodingTestRoot = Paths.get("src/test/examples/encoding").normalize(); |
| 25 | + |
| 26 | + // If an exception is thrown due to an unknown encoding it would |
| 27 | + // be here. |
| 28 | + FileStore.setWorkspaceRoots(Set.of(encodingTestRoot)); |
| 29 | + |
| 30 | + var file = FindResource.path("/org/javacs/example/EncodingWindows1252.java"); |
| 31 | + |
| 32 | + // Currently, non-unicode files are ignored. This test will change if |
| 33 | + // support is added in the future. |
| 34 | + assertThat(FileStore.suggestedPackageName(file), equalTo("")); |
| 35 | + } |
| 36 | +} |
0 commit comments