@Test void verifyRepoRegistered() { this.entityListenersService = new EntityListenersService(); String repoFullName = "EntityRepo"; EntityListener entityListener = Mockito.when(Mockito.mock(EntityListener.class).getEntityId()).thenReturn(1).getMock(); try { entityListenersService.addEntityListener(repoFullName, entityListener); } catch (MolgenisDataException mde) { entityListenersService.register(repoFullName); assertTrue(entityListenersService.isEmpty(repoFullName)); assertEquals( "Repository [EntityRepo] is not registered, please contact your administrator", mde.getMessage()); return; } fail(); }
private void verifyRepoRegistered(String repoFullName) { lock.readLock().lock(); try { if (!entityListenersByRepo.containsKey(requireNonNull(repoFullName))) { LOG.error( "Repository [{}] is not registered in the entity listeners service", repoFullName); throw new MolgenisDataException( "Repository [" + repoFullName + "] is not registered, please contact your administrator"); } } finally { lock.readLock().unlock(); } }
EntityListenersService { private void verifyRepoRegistered(String repoFullName) { lock.readLock().lock(); try { if (!entityListenersByRepo.containsKey(requireNonNull(repoFullName))) { LOG.error( "Repository [{}] is not registered in the entity listeners service", repoFullName); throw new MolgenisDataException( "Repository [" + repoFullName + "] is not registered, please contact your administrator"); } } finally { lock.readLock().unlock(); } } }
EntityListenersService { private void verifyRepoRegistered(String repoFullName) { lock.readLock().lock(); try { if (!entityListenersByRepo.containsKey(requireNonNull(repoFullName))) { LOG.error( "Repository [{}] is not registered in the entity listeners service", repoFullName); throw new MolgenisDataException( "Repository [" + repoFullName + "] is not registered, please contact your administrator"); } } finally { lock.readLock().unlock(); } }  }
EntityListenersService { private void verifyRepoRegistered(String repoFullName) { lock.readLock().lock(); try { if (!entityListenersByRepo.containsKey(requireNonNull(repoFullName))) { LOG.error( "Repository [{}] is not registered in the entity listeners service", repoFullName); throw new MolgenisDataException( "Repository [" + repoFullName + "] is not registered, please contact your administrator"); } } finally { lock.readLock().unlock(); } }  void addEntityListener(String repoFullName, EntityListener entityListener); boolean removeEntityListener(String repoFullName, EntityListener entityListener); }
EntityListenersService { private void verifyRepoRegistered(String repoFullName) { lock.readLock().lock(); try { if (!entityListenersByRepo.containsKey(requireNonNull(repoFullName))) { LOG.error( "Repository [{}] is not registered in the entity listeners service", repoFullName); throw new MolgenisDataException( "Repository [" + repoFullName + "] is not registered, please contact your administrator"); } } finally { lock.readLock().unlock(); } }  void addEntityListener(String repoFullName, EntityListener entityListener); boolean removeEntityListener(String repoFullName, EntityListener entityListener);  }