コード例 #1
0
  @Before
  public void setUp() {
    when(entityFactory.createMachine(machineDescriptor1)).thenReturn(machine1);
    when(entityFactory.createMachine(machineDescriptor2)).thenReturn(machine2);

    when(entityFactory.createMachineNode(
            isNull(MachineTreeNode.class),
            anyString(),
            Matchers.<List<MachineTreeNode>>anyObject()))
        .thenReturn(rootNode);

    //noinspection unchecked
    when(entityFactory.createMachineNode(eq(rootNode), eq(machineState2), isNull(List.class)))
        .thenReturn(machineNode2);
    //noinspection unchecked
    when(entityFactory.createMachineNode(eq(rootNode), eq(machineState1), isNull(List.class)))
        .thenReturn(machineNode1);

    presenter =
        new MachinePanelPresenter(
            view, service, entityFactory, locale, appliance, eventBus, resources, appContext);

    when(service.getMachinesStates(anyString())).thenReturn(machineStatePromise);
    when(machineStatePromise.then(Matchers.<Operation<List<MachineStateDto>>>anyObject()))
        .thenReturn(machineStatePromise);

    when(service.getMachine(anyString())).thenReturn(machinePromise);
    when(machinePromise.then(Matchers.<Operation<MachineDto>>anyObject()))
        .thenReturn(machinePromise);

    when(appContext.getWorkspace()).thenReturn(usersWorkspaceDto);
    when(usersWorkspaceDto.getId()).thenReturn(TEXT);
  }
コード例 #2
0
  @Before
  public void setUp() {
    when(appContext.getWorkspaceId()).thenReturn(WORKSPACE_ID);

    when(machineService.getMachines(anyString())).thenReturn(machinesPromise);
    when(machineService.getMachine(anyString())).thenReturn(machinePromise);
    when(machinePromise.then(Matchers.<Operation<MachineDto>>anyObject()))
        .thenReturn(machinePromise);

    when(machineService.getProcesses(anyString())).thenReturn(processesPromise);
    when(processesPromise.then(Matchers.<Operation<List<MachineProcessDto>>>anyObject()))
        .thenReturn(processesPromise);

    presenter =
        new ConsolesPanelPresenter(
            view,
            eventBus,
            dtoFactory,
            dialogFactory,
            entityFactory,
            terminalFactory,
            commandConsoleFactory,
            commandTypeRegistry,
            workspaceAgent,
            notificationManager,
            localizationConstant,
            machineService,
            resources,
            appContext);
  }