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);
}
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();
}
Aggregations