LightstreamerDetector extends AbstractServerDetector { protected boolean isLightStreamer(Instrumentation instrumentation) { Properties systemProperties = System.getProperties(); for (String expectedPropertyName : SYSTEM_PROERTY_NAMES) { if (systemProperties.containsKey(expectedPropertyName)) { return true; } } return false; }  ServerHandle detect(MBeanServerExecutor pMBeanServerExecutor); @Override void jvmAgentStartup(Instrumentation instrumentation);  }
@Test public void testIsLightStreamer_NotFound() { Instrumentation mockInstrumentation = createMock(Instrumentation.class); expect(mockInstrumentation.getAllLoadedClasses()).andReturn(new Class[0]); replay(mockInstrumentation); assertFalse(detector.isLightStreamer(mockInstrumentation)); }
@Test public void testIsLightStreamer_SystemPropertyFound() { String systemPropertyName = "com.lightstreamer.kernel_lib_path"; System.setProperty(systemPropertyName, "path"); try { Instrumentation mockInstrumentation = createMock(Instrumentation.class); assertTrue(detector.isLightStreamer(mockInstrumentation)); } finally { System.clearProperty(systemPropertyName); } }