/**
  * Constructor.
  *
  * @param jmxDefinitionDataIdentId the id of the related {@link JmxDefinitionDataIdent} of this
  *     {@link JmxSensorValueData}
  * @param value the value
  * @param timestamp the timestamp when this value was captured
  * @param platformIdent the id of the related {@link PlatformIdent}
  * @param sensorTypeIdent the id of the related {@link SensorTypeIdent}
  */
 public JmxSensorValueData(
     long jmxDefinitionDataIdentId,
     String value,
     Timestamp timestamp,
     long platformIdent,
     long sensorTypeIdent) {
   setJmxSensorDefinitionDataIdentId(jmxDefinitionDataIdentId);
   setValue(value);
   super.setTimeStamp(timestamp);
   super.setPlatformIdent(platformIdent);
   super.setSensorTypeIdent(sensorTypeIdent);
   super.setId(jmxDefinitionDataIdentId);
 }
  @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)));
  }