use of org.eclipse.jdt.ls.core.internal.preferences.ClientPreferences in project eclipse.jdt.ls by eclipse.
the class InitHandlerTest method testExecuteCommandProvider.
@Test
public void testExecuteCommandProvider() throws Exception {
ClientPreferences mockCapabilies = mock(ClientPreferences.class);
when(mockCapabilies.isExecuteCommandDynamicRegistrationSupported()).thenReturn(Boolean.FALSE);
when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies);
InitializeResult result = initialize(false);
List<String> commands = result.getCapabilities().getExecuteCommandProvider().getCommands();
assertFalse(commands.isEmpty());
}
use of org.eclipse.jdt.ls.core.internal.preferences.ClientPreferences in project eclipse.jdt.ls by eclipse.
the class InitHandlerTest method testExecuteCommandProviderDynamicRegistration.
@Test
public void testExecuteCommandProviderDynamicRegistration() throws Exception {
ClientPreferences mockCapabilies = mock(ClientPreferences.class);
when(mockCapabilies.isExecuteCommandDynamicRegistrationSupported()).thenReturn(Boolean.TRUE);
when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies);
InitializeResult result = initialize(true);
assertNull(result.getCapabilities().getExecuteCommandProvider());
}
use of org.eclipse.jdt.ls.core.internal.preferences.ClientPreferences in project eclipse.jdt.ls by eclipse.
the class CompletionHandlerTest method mockClientPreferences.
private ClientPreferences mockClientPreferences(boolean supportCompletionSnippets, boolean supportSignatureHelp) {
ClientPreferences mockCapabilies = Mockito.mock(ClientPreferences.class);
Mockito.when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies);
Mockito.when(mockCapabilies.isCompletionSnippetsSupported()).thenReturn(supportCompletionSnippets);
Mockito.when(mockCapabilies.isSignatureHelpSupported()).thenReturn(supportSignatureHelp);
return mockCapabilies;
}
use of org.eclipse.jdt.ls.core.internal.preferences.ClientPreferences in project eclipse.jdt.ls by eclipse.
the class CompletionHandlerTest method mockLSPClient.
private void mockLSPClient(boolean isSnippetSupported, boolean isSignatureHelpSuported) {
reset(preferenceManager);
ClientPreferences mockCapabilies = mock(ClientPreferences.class);
// Mock the preference manager to use LSP v3 support.
when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies);
when(mockCapabilies.isCompletionSnippetsSupported()).thenReturn(isSnippetSupported);
when(mockCapabilies.isSignatureHelpSupported()).thenReturn(isSignatureHelpSuported);
when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies);
}
Aggregations