Search in sources :

Example 16 with ClasspathEntryDto

use of org.eclipse.che.ide.ext.java.shared.dto.classpath.ClasspathEntryDto in project che by eclipse.

the class SourcepathMacroTest method sourcepathShouldBeBuiltWith2Libraries.

@Test
public void sourcepathShouldBeBuiltWith2Libraries() throws Exception {
    String source1 = "/name/source1";
    String source2 = "/name/source2";
    List<ClasspathEntryDto> entries = new ArrayList<>();
    Set<String> sources = new HashSet<>();
    sources.add(source1);
    sources.add(source2);
    when(classpathContainer.getClasspathEntries(anyString())).thenReturn(classpathEntriesPromise);
    when(classpathResolver.getSources()).thenReturn(sources);
    sourcepathMacro.expand();
    verify(classpathEntriesPromise).then(classpathEntriesCapture.capture());
    String classpath = classpathEntriesCapture.getValue().apply(entries);
    verify(classpathResolver).resolveClasspathEntries(entries);
    assertEquals("source2:source1:", classpath);
}
Also used : ArrayList(java.util.ArrayList) ClasspathEntryDto(org.eclipse.che.ide.ext.java.shared.dto.classpath.ClasspathEntryDto) Matchers.anyString(org.mockito.Matchers.anyString) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

ClasspathEntryDto (org.eclipse.che.ide.ext.java.shared.dto.classpath.ClasspathEntryDto)16 ArrayList (java.util.ArrayList)8 Project (org.eclipse.che.ide.api.resources.Project)8 Resource (org.eclipse.che.ide.api.resources.Resource)8 List (java.util.List)7 OperationException (org.eclipse.che.api.promises.client.OperationException)6 HashSet (java.util.HashSet)5 Test (org.junit.Test)5 Matchers.anyString (org.mockito.Matchers.anyString)5 Operation (org.eclipse.che.api.promises.client.Operation)4 PromiseError (org.eclipse.che.api.promises.client.PromiseError)4 JavaUtil.isJavaProject (org.eclipse.che.ide.ext.java.client.util.JavaUtil.isJavaProject)3 Collections.singletonList (java.util.Collections.singletonList)2 Set (java.util.Set)2 FunctionException (org.eclipse.che.api.promises.client.FunctionException)2 Container (org.eclipse.che.ide.api.resources.Container)2 Path (org.eclipse.che.ide.resource.Path)2 IClasspathEntry (org.eclipse.jdt.core.IClasspathEntry)2 ClasspathPagePresenter (org.eclipse.che.ide.ext.java.client.project.classpath.valueproviders.pages.ClasspathPagePresenter)1 IPath (org.eclipse.core.runtime.IPath)1