Search in sources :

Example 1 with SimpleValueDto

use of org.eclipse.che.api.debug.shared.dto.SimpleValueDto in project che by eclipse.

the class DebuggerTest method testGetValue.

@Test
public void testGetValue() throws Exception {
    final VariableDto variableDto = mock(VariableDto.class);
    final Variable variable = mock(Variable.class);
    final Promise<SimpleValueDto> promiseValue = mock(Promise.class);
    doReturn(variableDto).when(dtoFactory).createDto(VariableDto.class);
    doReturn(mock(VariablePathDto.class)).when(dtoFactory).createDto(VariablePathDto.class);
    doReturn(mock(VariablePathDto.class)).when(variable).getVariablePath();
    doReturn(Collections.emptyList()).when(variable).getVariables();
    doReturn(promiseValue).when(service).getValue(SESSION_ID, variableDto);
    doReturn(promiseValue).when(promiseValue).then((Function<SimpleValueDto, Object>) any());
    doReturn(promiseValue).when(promiseValue).catchError((Operation<PromiseError>) any());
    Promise<SimpleValue> result = debugger.getValue(variable);
    assertEquals(promiseValue, result);
}
Also used : Variable(org.eclipse.che.api.debug.shared.model.Variable) VariablePathDto(org.eclipse.che.api.debug.shared.dto.VariablePathDto) PromiseError(org.eclipse.che.api.promises.client.PromiseError) VariableDto(org.eclipse.che.api.debug.shared.dto.VariableDto) SimpleValueDto(org.eclipse.che.api.debug.shared.dto.SimpleValueDto) SimpleValue(org.eclipse.che.api.debug.shared.model.SimpleValue) BaseTest(org.eclipse.che.plugin.debugger.ide.BaseTest) Test(org.junit.Test)

Example 2 with SimpleValueDto

use of org.eclipse.che.api.debug.shared.dto.SimpleValueDto in project che by eclipse.

the class DebuggerPresenterTest method testOnExpandVariablesTree.

@Test
public void testOnExpandVariablesTree() throws OperationException {
    SimpleValueDto valueDto = mock(SimpleValueDto.class);
    List<MutableVariable> rootVariables = mock(List.class);
    doReturn(true).when(rootVariables).isEmpty();
    doReturn(rootVariables).when(selectedVariable).getVariables();
    doReturn(promiseValue).when(debugger).getValue(selectedVariable);
    doReturn(promiseValue).when(promiseValue).then((Operation<SimpleValueDto>) any());
    presenter.onExpandVariablesTree();
    verify(promiseValue).then(operationValueCaptor.capture());
    operationValueCaptor.getValue().apply(valueDto);
    verify(view).setVariablesIntoSelectedVariable(any());
    verify(view).updateSelectedVariable();
    verify(promiseValue).catchError(operationPromiseErrorCaptor.capture());
    operationPromiseErrorCaptor.getValue().apply(promiseError);
    notificationManager.notify(any(), eq(ERROR_MESSAGE), eq(FAIL), eq(FLOAT_MODE));
    verify(constant).failedToGetVariableValueTitle();
}
Also used : MutableVariable(org.eclipse.che.api.debug.shared.model.MutableVariable) SimpleValueDto(org.eclipse.che.api.debug.shared.dto.SimpleValueDto) Test(org.junit.Test) BaseTest(org.eclipse.che.plugin.debugger.ide.BaseTest)

Aggregations

SimpleValueDto (org.eclipse.che.api.debug.shared.dto.SimpleValueDto)2 BaseTest (org.eclipse.che.plugin.debugger.ide.BaseTest)2 Test (org.junit.Test)2 VariableDto (org.eclipse.che.api.debug.shared.dto.VariableDto)1 VariablePathDto (org.eclipse.che.api.debug.shared.dto.VariablePathDto)1 MutableVariable (org.eclipse.che.api.debug.shared.model.MutableVariable)1 SimpleValue (org.eclipse.che.api.debug.shared.model.SimpleValue)1 Variable (org.eclipse.che.api.debug.shared.model.Variable)1 PromiseError (org.eclipse.che.api.promises.client.PromiseError)1