SyncManagerImpl extends AbstractServiceTracker<SyncHandler> implements SyncManager { @Override public SyncHandler getSyncHandler(@NotNull String name) { for (SyncHandler handler: getServices()) { if (name.equals(handler.getName())) { return handler; } } return null; } @SuppressWarnings("UnusedDeclaration")  SyncManagerImpl();  SyncManagerImpl(Whiteboard whiteboard); @Override SyncHandler getSyncHandler(@NotNull String name);  }
@Test public void testGetHandler() { assertNull(syncManager.getSyncHandler("test")); assertNull(syncManager.getSyncHandler("another")); SyncHandler syncHandler = when(mock(SyncHandler.class).getName()).thenReturn("test").getMock(); context.registerService(SyncHandler.class, syncHandler); assertSame(syncHandler, syncManager.getSyncHandler("test")); assertNull(syncManager.getSyncHandler("another")); }