### Question:
ExportServiceListener implements ServiceListener { public Set<String> getServiceInterfaces(Object service, String[] services) { Set<String> interfaceList = new LinkedHashSet<String>(); if (service != null && services != null && services.length > 0) { for (String s : services) { if (Constants.ALL_INTERFACES.equals(s)) { Class[] classes = service.getClass().getInterfaces(); if (classes != null && classes.length > 0) { for (Class c : classes) { interfaceList.add(c.getCanonicalName()); } } } else { try { ClassLoader classLoader = null; if (service.getClass() != null && service.getClass().getClassLoader() != null) { classLoader = service.getClass().getClassLoader(); } else { classLoader = ClassLoader.getSystemClassLoader(); } Class clazz = classLoader.loadClass(s); String ifaceName = clazz.getCanonicalName(); interfaceList.add(ifaceName); } catch (ClassNotFoundException e) { LOGGER.error("CELLAR DOSGI: could not load class", e); } } } } return interfaceList; }  void init(); void destroy(); @Override void serviceChanged(ServiceEvent event); void exportService(ServiceReference serviceReference); void unExportService(ServiceReference serviceReference); Set<String> getServiceInterfaces(Object service, String[] services); ClusterManager getClusterManager(); void setClusterManager(ClusterManager clusterManager); EventTransportFactory getEventTransportFactory(); void setEventTransportFactory(EventTransportFactory eventTransportFactory); BundleContext getBundleContext(); void setBundleContext(BundleContext bundleContext);  }### Answer:
@Test public void testGetServiceInterfaces() throws Exception { System.out.println("Test Service interfaces with null service"); Set<String> expectedResult = new LinkedHashSet<String>(); Set<String> result = listener.getServiceInterfaces(null,null); Assert.assertEquals(expectedResult,result); result = listener.getServiceInterfaces(null,new String[] {"*"}); Assert.assertEquals(expectedResult,result); System.out.println("Test Service interfaces with ArrayList and wildcard services"); result = listener.getServiceInterfaces(new ArrayList(),new String[] {"*"}); Assert.assertTrue(result.contains("java.util.List")); System.out.println("Test Service interfaces with ArrayList and List/Serializable services"); result = listener.getServiceInterfaces(new ArrayList(),new String[] {"java.util.List","java.io.Serializable"}); Assert.assertTrue(result.contains("java.util.List")); Assert.assertTrue(result.contains("java.io.Serializable")); }