Пример #1
0
  @Test(expected = InvalidOperationException.class)
  public void testStartAppsWithOverloaded() throws InvalidOperationException {
    controller.setConfigurationReader(configurationReader);
    controller.startTablet();

    TabletStatus status = controller.getCurrentStatus();
    status.isOverloaded = true;
    controller.startApps(1, 1);
  }
Пример #2
0
  @Test()
  public void testWithMock() throws InvalidOperationException {
    TabletStatus status = new TabletStatus();

    status.isOverloaded = false;
    status.cpuSpeed = 1000;
    status.freeMemory = 3000;
    status.applications = 0;

    when(mockConfigurationReader.getStatus()).thenReturn(status);
    when(mockConfigurationReader.updateStatus()).thenReturn(true);

    controller.setConfigurationReader(mockConfigurationReader);

    TabletStatus returnStatus = controller.startApps(1, 1);
    Assert.assertEquals(false, returnStatus.isOverloaded);
    Assert.assertEquals(1055, returnStatus.cpuSpeed);
    Assert.assertEquals(2950, returnStatus.freeMemory);
    Assert.assertEquals(1, returnStatus.applications);
  }