BaseService implements Service { public BaseService(String prefix) { this.prefix = prefix; } BaseService(String prefix); @Override final void init(Server server); @Override void postInit(); @Override void destroy(); @Override Class[] getServiceDependencies(); @Override void serverStatusChange(Server.Status oldStatus,
      Server.Status newStatus);  }
@Test public void baseService() throws Exception { BaseService service = new MyService(); assertNull(service.getInterface()); assertEquals(service.getPrefix(), "myservice"); assertEquals(service.getServiceDependencies().length, 0); Server server = Mockito.mock(Server.class); Configuration conf = new Configuration(false); conf.set("server.myservice.foo", "FOO"); conf.set("server.myservice1.bar", "BAR"); Mockito.when(server.getConfig()).thenReturn(conf); Mockito.when(server.getPrefixedName("myservice.foo")) .thenReturn("server.myservice.foo"); Mockito.when(server.getPrefixedName("myservice.")) .thenReturn("server.myservice."); service.init(server); assertEquals(service.getPrefixedName("foo"), "server.myservice.foo"); assertEquals(service.getServiceConfig().size(), 1); assertEquals(service.getServiceConfig().get("foo"), "FOO"); assertTrue(MyService.INIT); }