NotifyOtherPaps { protected void startNotifyThreads(List<?> otherServers, long entityId, String entityType, String newGroupId) { LinkedList<Thread> notifyThreads = new LinkedList<>(); for (Object obj : otherServers) { Thread newNotifyThread = new Thread(new NotifyOtherThread(obj, entityId, entityType, newGroupId)); newNotifyThread.start(); notifyThreads.add(newNotifyThread); } for (Thread t : notifyThreads) { try { t.join(); } catch (Exception e) { LOGGER.warn("Could not join a notifcation thread" + e); } } }  void notifyOthers(long entityId, String entityType); void notifyOthers(long entityId, String entityType, String newGroupId);  }
@Test public void negTestNotify() { NotifyOtherPaps notify = new NotifyOtherPaps(); List<PolicyDbDaoEntity> otherServers = new ArrayList<PolicyDbDaoEntity>(); PolicyDbDaoEntity dbdaoEntity = new PolicyDbDaoEntity(); dbdaoEntity.setPolicyDbDaoUrl("http: otherServers.add(dbdaoEntity); long entityId = 0; String entityType = "entityType"; String newGroupId = "newGroupId"; assertThatCode(() -> notify.startNotifyThreads(otherServers, entityId, entityType, newGroupId)) .doesNotThrowAnyException(); }