diff options
author | George Fraser <george@fivetran.com> | 2019-01-09 00:07:25 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2019-01-09 00:07:25 -0800 |
commit | 2a29930c8677b75b9c99a9cd5339f0b8009e72f4 (patch) | |
tree | 4bb98471450d85dd3a2f8cfa278157e823569e8b /src/test/java/org/javacs | |
parent | 04e4f359cb80c7b8e450103dc7331f6deb363872 (diff) | |
download | java-language-server-2a29930c8677b75b9c99a9cd5339f0b8009e72f4.zip |
Reader access flags directly from class file
Diffstat (limited to 'src/test/java/org/javacs')
-rw-r--r-- | src/test/java/org/javacs/ClassesTest.java | 11 | ||||
-rw-r--r-- | src/test/java/org/javacs/SourceFileManagerTest.java | 13 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/test/java/org/javacs/ClassesTest.java b/src/test/java/org/javacs/ClassesTest.java index 95212fe..c5e2a7e 100644 --- a/src/test/java/org/javacs/ClassesTest.java +++ b/src/test/java/org/javacs/ClassesTest.java @@ -16,18 +16,16 @@ public class ClassesTest { @Test public void list() { var jdk = Classes.jdkTopLevelClasses(); - assertThat(jdk.classes(), hasItem("java.util.List")); - assertThat(jdk.load("java.util.List"), not(nullValue())); + assertThat(jdk, hasItem("java.util.List")); var empty = Classes.classPathTopLevelClasses(Collections.emptySet()); - assertThat(empty.classes(), not(hasItem("java.util.List"))); + assertThat(empty, not(hasItem("java.util.List"))); } @Test public void arrayList() { var jdk = Classes.jdkTopLevelClasses(); - assertThat(jdk.classes(), hasItem("java.util.ArrayList")); - assertThat(jdk.load("java.util.ArrayList"), not(nullValue())); + assertThat(jdk, hasItem("java.util.ArrayList")); } @Test @@ -46,9 +44,6 @@ public class ClassesTest { var main = found.stream().filter(c -> c.getName().equals("org.javacs.Main")).findFirst(); assertTrue(main.isPresent()); - - var load = main.get().load(); - assertNotNull(load); } void ancestors(ClassLoader classLoader) { diff --git a/src/test/java/org/javacs/SourceFileManagerTest.java b/src/test/java/org/javacs/SourceFileManagerTest.java index 64a35ac..3b50327 100644 --- a/src/test/java/org/javacs/SourceFileManagerTest.java +++ b/src/test/java/org/javacs/SourceFileManagerTest.java @@ -71,5 +71,18 @@ public class SourceFileManagerTest { assertThat(sourceClassName, equalTo(standardJavaName)); } + @Test + public void javaUtilList() throws IOException { + var file = + sourceFileManager.getJavaFileForInput( + StandardLocation.PLATFORM_CLASS_PATH, "java.util.List", JavaFileObject.Kind.CLASS); + assertThat("Found java.util.List in platform classpath", file, notNullValue()); + + var header = ClassHeader.of(file.openInputStream()); + assertTrue(header.isInterface); + assertTrue(header.isAbstract); + assertTrue(header.isPublic); + } + private static final Logger LOG = Logger.getLogger("main"); } |