@Test
  public void idNotAvailableTest() throws IdNotAvailableException {
    long uptime = 12345L;
    long sensorTypeIdent = 13L;

    when(runtimeBean.getUptime()).thenReturn(uptime);

    when(idManager.getPlatformId()).thenThrow(new IdNotAvailableException("expected"));
    when(idManager.getRegisteredSensorTypeId(sensorTypeIdent))
        .thenThrow(new IdNotAvailableException("expected"));

    // there is no current data object available
    when(coreService.getPlatformSensorData(sensorTypeIdent)).thenReturn(null);
    runtimeInfo.update(coreService, sensorTypeIdent);

    ArgumentCaptor<SystemSensorData> sensorDataCaptor =
        ArgumentCaptor.forClass(SystemSensorData.class);
    verify(coreService, times(0))
        .addPlatformSensorData(eq(sensorTypeIdent), sensorDataCaptor.capture());
  }
  @Test
  public void oneDataSet() throws IdNotAvailableException {
    long uptime = 12345L;
    long sensorTypeIdent = 13L;
    long platformIdent = 11L;

    when(runtimeBean.getUptime()).thenReturn(uptime);

    when(idManager.getPlatformId()).thenReturn(platformIdent);
    when(idManager.getRegisteredSensorTypeId(sensorTypeIdent)).thenReturn(sensorTypeIdent);

    // there is no current data object available
    when(coreService.getPlatformSensorData(sensorTypeIdent)).thenReturn(null);
    runtimeInfo.update(coreService, sensorTypeIdent);

    // -> The service must create a new one and add it to the storage
    // We use an argument capturer to further inspect the given argument.
    ArgumentCaptor<SystemSensorData> sensorDataCaptor =
        ArgumentCaptor.forClass(SystemSensorData.class);
    verify(coreService, times(1))
        .addPlatformSensorData(eq(sensorTypeIdent), sensorDataCaptor.capture());

    SystemSensorData sensorData = sensorDataCaptor.getValue();
    assertThat(sensorData, is(instanceOf(RuntimeInformationData.class)));
    assertThat(sensorData.getPlatformIdent(), is(equalTo(platformIdent)));
    assertThat(sensorData.getSensorTypeIdent(), is(equalTo(sensorTypeIdent)));

    RuntimeInformationData runtimeData = (RuntimeInformationData) sensorData;
    assertThat(runtimeData.getCount(), is(equalTo(1)));

    // as there was only one data object min/max/total the values must be the
    // same
    assertThat(runtimeData.getMinUptime(), is(equalTo(uptime)));
    assertThat(runtimeData.getMaxUptime(), is(equalTo(uptime)));
    assertThat(runtimeData.getTotalUptime(), is(equalTo(uptime)));
  }