diff options
author | George Fraser <george@fivetran.com> | 2018-05-19 20:55:56 -0700 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2018-05-19 20:55:56 -0700 |
commit | a1808a6be7298f9b5f5a5705ca46d714ba583b03 (patch) | |
tree | 50478a927025c86c3b20c67b0ecb7846cd886b32 /src/test | |
parent | 836017e17fcb4c434db64730e6f2b3fa9a8b2f55 (diff) | |
download | java-language-server-a1808a6be7298f9b5f5a5705ca46d714ba583b03.zip |
Wrapper for incremental javac
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/org/javacs/JavaPresentationCompilerTest.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/java/org/javacs/JavaPresentationCompilerTest.java b/src/test/java/org/javacs/JavaPresentationCompilerTest.java new file mode 100644 index 0000000..b191883 --- /dev/null +++ b/src/test/java/org/javacs/JavaPresentationCompilerTest.java @@ -0,0 +1,38 @@ +package org.javacs; + +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.assertTrue; + +import com.sun.source.util.*; +import java.io.IOException; +import java.net.URI; +import java.util.*; +import java.util.logging.*; +import javax.lang.model.*; +import javax.lang.model.element.*; +import javax.lang.model.type.*; +import javax.tools.*; +import org.junit.Test; + +public class JavaPresentationCompilerTest { + private static final Logger LOG = Logger.getLogger("main"); + + private JavaPresentationCompiler compiler = new JavaPresentationCompiler(); + + private String helloWorld = + "public class HelloWorld {\n" + + " public static void main(String[] args) {\n" + + " System.out.println(\"Hello world!\");\n" + + " }\n" + + "}"; + + @Test + public void element() throws IOException { + Optional<Element> found = + compiler.element(URI.create("/HelloWorld.java"), helloWorld, 3, 18); + + assertTrue(found.isPresent()); + + LOG.info(found.get().toString()); + } +} |