Search in sources :

Example 6 with ReferencedLibraries

use of org.eclipse.jdt.ls.core.internal.preferences.Preferences.ReferencedLibraries in project eclipse.jdt.ls by eclipse.

the class InvisibleProjectBuildSupportTest method testVariableReferenceLibraries.

@Test
public void testVariableReferenceLibraries() throws Exception {
    ReferencedLibraries libraries = new ReferencedLibraries();
    libraries.getInclude().add("~/lib/foo.jar");
    libraries.getExclude().add("~/lib/bar.jar");
    libraries.getSources().put("~/library/bar.jar", "~/library/sources/bar-src.jar");
    assertTrue(libraries.getInclude().iterator().next().startsWith(System.getProperty("user.home")));
    assertTrue(libraries.getExclude().iterator().next().startsWith(System.getProperty("user.home")));
    libraries.getSources().forEach((k, v) -> {
        assertTrue(k.startsWith(System.getProperty("user.home")));
        assertTrue(v.startsWith(System.getProperty("user.home")));
    });
    libraries = new ReferencedLibraries();
    libraries.getInclude().add("${java.home}/lib/foo.jar");
    libraries.getExclude().add("${java.home}/lib/bar.jar");
    libraries.getSources().put("${java.home}/library/bar.jar", "${java.home}/library/sources/bar-src.jar");
    assertTrue(libraries.getInclude().iterator().next().startsWith(System.getProperty("java.home")));
    assertTrue(libraries.getExclude().iterator().next().startsWith(System.getProperty("java.home")));
    libraries.getSources().forEach((k, v) -> {
        assertTrue(k.startsWith(System.getProperty("java.home")));
        assertTrue(v.startsWith(System.getProperty("java.home")));
    });
    libraries = new ReferencedLibraries();
    libraries.getInclude().add("${foo}");
    assertTrue(libraries.getInclude().iterator().next().equals("${foo}"));
}
Also used : ReferencedLibraries(org.eclipse.jdt.ls.core.internal.preferences.Preferences.ReferencedLibraries) Test(org.junit.Test) HoverHandlerTest(org.eclipse.jdt.ls.core.internal.handlers.HoverHandlerTest)

Aggregations

ReferencedLibraries (org.eclipse.jdt.ls.core.internal.preferences.Preferences.ReferencedLibraries)6 HoverHandlerTest (org.eclipse.jdt.ls.core.internal.handlers.HoverHandlerTest)5 Test (org.junit.Test)5 IProject (org.eclipse.core.resources.IProject)4 IPath (org.eclipse.core.runtime.IPath)3 IJavaProject (org.eclipse.jdt.core.IJavaProject)3 File (java.io.File)2 IMarker (org.eclipse.core.resources.IMarker)2 TextDocumentPositionParams (org.eclipse.lsp4j.TextDocumentPositionParams)2 URI (java.net.URI)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 IFolder (org.eclipse.core.resources.IFolder)1 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)1 IJobChangeListener (org.eclipse.core.runtime.jobs.IJobChangeListener)1 JobChangeAdapter (org.eclipse.core.runtime.jobs.JobChangeAdapter)1 IClasspathEntry (org.eclipse.jdt.core.IClasspathEntry)1