@Test void noPlatformSensorTypeConfigFound() throws Exception { PlatformSensorTypeConfig platformSensorTypeConfigA = Mockito.mock(PlatformSensorTypeConfig.class); when(platformSensorTypeConfigA.getClassName()).thenReturn("A"); when(this.configurationStorage.getPlatformSensorTypes()).thenReturn(Arrays.asList(platformSensorTypeConfigA)); this.cut.afterPropertiesSet(); verifyZeroInteractions(this.sensorTypeConfig); }
@Test void platformSensorTypeConfigFound() throws Exception { PlatformSensorTypeConfig platformSensorTypeConfigA = Mockito.mock(PlatformSensorTypeConfig.class); PlatformSensorTypeConfig platformSensorTypeConfigB = Mockito.mock(PlatformSensorTypeConfig.class); when(platformSensorTypeConfigA.getClassName()).thenReturn("A"); when(platformSensorTypeConfigB.getClassName()).thenReturn("rocks.inspectit.agent.java.sensor.platform.AbstractPlatformSensorFakeImpl"); when(this.configurationStorage.getPlatformSensorTypes()).thenReturn(Arrays.asList(platformSensorTypeConfigA, platformSensorTypeConfigB)); this.cut.afterPropertiesSet(); assertThat(this.cut.getSensorTypeConfig(), sameInstance(platformSensorTypeConfigB)); }
@Test void initExistingPlatformSensorData() throws Exception { PlatformSensorTypeConfig platformSensorTypeConfigA = Mockito.mock(PlatformSensorTypeConfig.class); when(platformSensorTypeConfigA.getClassName()).thenReturn("rocks.inspectit.agent.java.sensor.platform.AbstractPlatformSensorFakeImpl"); when(this.configurationStorage.getPlatformSensorTypes()).thenReturn(Arrays.asList(platformSensorTypeConfigA)); when(this.platformManager.getPlatformId()).thenReturn(1337L); when(platformSensorTypeConfigA.getId()).thenReturn(73L); this.cut.afterPropertiesSet(); SystemSensorData systemSensorData = this.cut.getSystemSensorData(); verify(systemSensorData).setPlatformIdent(1337L); verify(systemSensorData).setSensorTypeIdent(73L); }