use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class NavigateToDefinitionHandlerTest method setUp.
@Before
public void setUp() throws Exception {
preferenceManager = mock(PreferenceManager.class);
when(preferenceManager.getPreferences()).thenReturn(new Preferences());
handler = new NavigateToDefinitionHandler(preferenceManager);
importProjects("maven/salut");
project = WorkspaceHelper.getProject("salut");
}
use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class CodeLensHandlerTest method setup.
@Before
public void setup() throws Exception {
importProjects("eclipse/hello");
project = WorkspaceHelper.getProject("hello");
preferenceManager = mock(PreferenceManager.class);
when(preferenceManager.getPreferences()).thenReturn(new Preferences());
handler = new CodeLensHandler(preferenceManager);
}
use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class CodeLensHandlerTest method testGetCodeLensSymbolsForClass.
@Test
public void testGetCodeLensSymbolsForClass() throws Exception {
Preferences implementationsCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.IMPLEMENTATIONS_CODE_LENS_ENABLED_KEY, "true"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(implementationsCodeLenses);
handler = new CodeLensHandler(preferenceManager);
String uriString = ClassFileUtil.getURI(project, "java.lang.Runnable");
String payload = createCodeLensSymbolRequest(new URI(uriString));
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
List<CodeLens> lenses = handler.getCodeLensSymbols(uri, monitor);
assertEquals("Found " + lenses, 3, lenses.size());
}
use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class CodeLensHandlerTest method testDisableCodeLensSymbols.
@Test
public void testDisableCodeLensSymbols() throws Exception {
Preferences noCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.REFERENCES_CODE_LENS_ENABLED_KEY, "false"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(noCodeLenses);
handler = new CodeLensHandler(preferenceManager);
String payload = createCodeLensSymbolsRequest("src/java/IFoo.java");
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
// when
List<CodeLens> result = handler.getCodeLensSymbols(uri, monitor);
// then
assertEquals(0, result.size());
}
use of org.eclipse.jdt.ls.core.internal.preferences.Preferences in project eclipse.jdt.ls by eclipse.
the class CodeLensHandlerTest method testDisableImplementationsCodeLensSymbols.
@Test
public void testDisableImplementationsCodeLensSymbols() throws Exception {
Preferences noImplementationsCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.IMPLEMENTATIONS_CODE_LENS_ENABLED_KEY, "false"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(noImplementationsCodeLenses);
Preferences noReferencesCodeLenses = Preferences.createFrom(Collections.singletonMap(Preferences.REFERENCES_CODE_LENS_ENABLED_KEY, "false"));
Mockito.reset(preferenceManager);
when(preferenceManager.getPreferences()).thenReturn(noReferencesCodeLenses);
handler = new CodeLensHandler(preferenceManager);
String payload = createCodeLensSymbolsRequest("src/java/IFoo.java");
CodeLensParams codeLensParams = getParams(payload);
String uri = codeLensParams.getTextDocument().getUri();
assertFalse(uri.isEmpty());
// when
List<CodeLens> result = handler.getCodeLensSymbols(uri, monitor);
// then
assertEquals(0, result.size());
}
Aggregations