@Test
public void configurePlatformSensor() throws Exception {
long agentId = 13L;
long sensorId = 17L;
String className = "className";
Map<String, Object> parameters = Collections.<String, Object> singletonMap("key", "value");
IPlatformSensorConfig platformSensorConfig = mock(IPlatformSensorConfig.class);
when(platformSensorConfig.getClassName()).thenReturn(className);
when(platformSensorConfig.getParameters()).thenReturn(parameters);
when(platformSensorConfig.isActive()).thenReturn(true);
when(environment.getPlatformSensorConfigs()).thenReturn(Collections.singletonList(platformSensorConfig));
when(registrationService.registerPlatformSensorTypeIdent(agentId, className)).thenReturn(sensorId);
AgentConfig agentConfiguration = creator.environmentToConfiguration(environment, agentId);
Collection<PlatformSensorTypeConfig> sensorTypeConfigs = agentConfiguration.getPlatformSensorTypeConfigs();
assertThat(sensorTypeConfigs, hasSize(1));
PlatformSensorTypeConfig sensorTypeConfig = sensorTypeConfigs.iterator().next();
assertThat(sensorTypeConfig.getId(), is(sensorId));
assertThat(sensorTypeConfig.getClassName(), is(className));
assertThat(sensorTypeConfig.getParameters(), is(parameters));
verify(registrationService).registerPlatformSensorTypeIdent(agentId, className);
verify(registrationService).registerMethodSensorTypeIdent(anyLong(), eq(eisc.getClassName()), eq(eisc.getParameters()));
verify(registrationService).registerMethodSensorTypeIdent(anyLong(), eq(closeableHttpAsyncCLient.getClassName()), eq(closeableHttpAsyncCLient.getParameters()));
verifyNoMoreInteractions(registrationService);
}