### Question:
JMeterSensor implements Sensor { protected GlobalSummary getGlobalSummary(Project project) { GlobalSummary globalSummary = null; String localJtlPath = getLocalJtlFilePath(project); String projectName = project.getName(); try { if (!StringUtils.isBlank(localJtlPath)) { LOG.info("Getting JMeter results from local file"); ConfigInfo configInfo = new ConfigInfo(localJtlPath); configService.setTestConfigInfo(projectName, configInfo); globalSummary = metricService.getGlobalSummary(projectName); } else { LOG.info("Getting JMeter results from remote server"); configService.setTestConfigInfo(projectName, null); JMeterReportClient client = getReportClient(project); String config = getTestConfigName(project); globalSummary = client.getGlobalSummary(config); } } catch(JTLFileNotFoundException e) { skipIfNotJtlOrThrowException(e); } catch(ServerErrorException e) { skipIfNotJtlOrThrowException(e); } return globalSummary; } JMeterSensor(Settings settings); boolean shouldExecuteOnProject(Project project); void analyse(Project project, SensorContext context); @Override String toString();  }### Answer:
@Test public void testLocalJtlPathConfig() { Settings settings = new Settings(); settings.setProperty(JMeterPluginConst.LOCAL_JTL_PATH_PROPERTY, "classpath:/test-http.jtl.xml"); JMeterSensor sensor = new JMeterSensor(settings); Project project = new Project("test-http-key","","test-http"); Assert.assertNotNull(sensor.getGlobalSummary(project)); }
@Test public void testSkipWhenLocalJtlNotExists() { Settings settings = new Settings(); settings.setProperty(JMeterPluginConst.LOCAL_JTL_PATH_PROPERTY, "classpath:/notexistingpath/test.jtl.xml"); JMeterSensor sensor = new JMeterSensor(settings); Project project = new Project("mytestproject","","notexisting"); Assert.assertNull(sensor.getGlobalSummary(project)); }
@Test public void testSkipWhenRemoteJtlNotExists() { JMeterReportServer server = new JMeterReportServer(); server.start(); try { Thread.sleep(SERVER_START_TIME); } catch (InterruptedException e) { } try { Settings settings = new Settings(); settings.setProperty(JMeterPluginConst.HOST_PROPERTY, "localhost"); settings.setProperty(JMeterPluginConst.CONFIG_PROPERTY, "A"); JMeterSensor sensor = new JMeterSensor(settings); Project project = new Project("mytestproject","","notexisting"); Assert.assertNull(sensor.getGlobalSummary(project)); } finally { server.stop(); try { Thread.sleep(SERVER_STOP_TIME); } catch (InterruptedException e) { } } }