DataServiceResolverDelegate implements DataServiceResolver { @Override public DataServiceMeta getDataService( String dataServiceName ) { for ( DataServiceResolver resolver : resolvers ) { DataServiceMeta dataServiceMeta = resolver.getDataService( dataServiceName ); if ( dataServiceMeta != null ) { return dataServiceMeta; } } return null; } DataServiceResolverDelegate();  DataServiceResolverDelegate( List<DataServiceResolver> resolvers ); void addResolver( DataServiceResolver resolver ); void removeResolver( DataServiceResolver resolver ); @Override List<DataServiceMeta> getDataServices( Function<Exception, Void> logger ); @Override List<DataServiceMeta> getDataServices( String dataServiceName, Function<Exception, Void> logger ); @Override DataServiceMeta getDataService( String dataServiceName ); @Override List<String> getDataServiceNames( String dataServiceName ); @Override DataServiceExecutor.Builder createBuilder( SQL sql ); @Override List<String> getDataServiceNames();  }
@Test public void testGetDataServiceWithName() { DataServiceMeta returnDataServiceMeta = dataServiceResolverDelegate.getDataService( DATA_SERVICE_NAME ); assertEquals( returnDataServiceMeta, dataServiceMeta ); verify( resolver ).getDataService( DATA_SERVICE_NAME ); }
@Test public void testGetDataServiceWithNameRetNull() { when( resolver.getDataService( DATA_SERVICE_NAME ) ).thenReturn( null ); DataServiceMeta returnDataServiceMeta = dataServiceResolverDelegate.getDataService( DATA_SERVICE_NAME ); assertNull( returnDataServiceMeta ); verify( resolver ).getDataService( DATA_SERVICE_NAME ); }
@Test public void testGetDataServiceNoResolvers() { DataServiceResolverDelegate nullDataServiceResolverDelegate = new DataServiceResolverDelegate(); DataServiceMeta returnDataServiceMeta = nullDataServiceResolverDelegate.getDataService( DATA_SERVICE_NAME ); assertNull( returnDataServiceMeta ); }