### Question:
DatasourceService { public boolean isMetadataDatasource( String id ) { Domain domain; try { domain = metadataDomainRepository.getDomain( id ); if ( domain == null ) { return false; } } catch ( Exception e ) { return false; } return isMetadataDatasource( domain ); } DatasourceService(); static boolean canAdminister(); static void validateAccess(); boolean isMetadataDatasource( String id ); static boolean isMetadataDatasource( Domain domain ); static void parseMondrianSchemaName( String dswId, Map<String, InputStream> fileData ); void ensureDataAccessPermission();  }### Answer:
@Test public void isMetadataDomainTest() throws ObjectFactoryException { Domain domain = mock( Domain.class ); List<LogicalModel> logicalModelList = new ArrayList<>( ); LogicalModel model = new LogicalModel(); LogicalModel model2 = new LogicalModel(); assertFalse( DatasourceService.isMetadataDatasource( (Domain) null ) ); assertTrue( DatasourceService.isMetadataDatasource( domain ) ); logicalModelList.add( model ); when(domain.getLogicalModels()).thenReturn( logicalModelList ); assertTrue( DatasourceService.isMetadataDatasource( domain ) ); model.setProperty( "AGILE_BI_GENERATED_SCHEMA", true ); assertFalse( DatasourceService.isMetadataDatasource( domain ) ); model2.setProperty( "WIZARD_GENERATED_SCHEMA", true ); logicalModelList.clear(); logicalModelList.add( model2 ); assertFalse( DatasourceService.isMetadataDatasource( domain ) ); }