MonitorDataService { public Set<String> findHandlersByEnvironment( String environmentId ) throws DaoException { Preconditions.checkArgument( !StringUtils.isBlank( environmentId ), INVALID_ENV_ID ); return subscriberDao.findHandlersByEnvironment( environmentId ); } MonitorDataService( EntityManagerFactory emf ); void addSubscription( String environmentId, String subscriberId ); void removeSubscription( String environmentId, String subscriberId ); Set<String> findHandlersByEnvironment( String environmentId );  }
@Test public void testGetEnvironmentSubscribersIds() throws Exception { Set<String> subscribersIds = monitorDao.findHandlersByEnvironment( ENVIRONMENT_ID ); assertTrue( subscribersIds.contains( SUBSCRIBER_ID ) ); }
@Test( expected = DaoException.class ) public void testGetEnvironmentSubscribersIdsException() throws Exception { throwDbException(); monitorDao.findHandlersByEnvironment( ENVIRONMENT_ID ); }