### Question:
DSWDatasourceServiceImpl implements IDSWDatasourceService { public boolean hasPermission() { if ( PentahoSessionHolder.getSession() != null ) { IAuthorizationPolicy policy = PentahoSystem.get( IAuthorizationPolicy.class, PentahoSessionHolder.getSession() ); return policy.isAllowed( RepositoryReadAction.NAME ) && policy.isAllowed( RepositoryCreateAction.NAME ) && ( policy.isAllowed( AdministerSecurityAction.NAME ) ); } else { return false; } } DSWDatasourceServiceImpl();  DSWDatasourceServiceImpl( ConnectionServiceImpl connService ); boolean deleteLogicalModel( String domainId, String modelName ); SerializedResultSet doPreview( String connectionName, String query, String previewLimit ); boolean testDataSourceConnection( String connectionName ); BusinessData generateLogicalModel( String modelName, String connectionName, String dbType, String query,
                                            String previewLimit ); IMetadataDomainRepository getMetadataDomainRepository(); void setMetadataDomainRepository( IMetadataDomainRepository metadataDomainRepository ); boolean saveLogicalModel( Domain domain, boolean overwrite ); boolean hasPermission(); List<LogicalModelSummary> getLogicalModels( String context ); BusinessData loadBusinessData( String domainId, String modelId ); BogoPojo gwtWorkaround( BogoPojo pojo ); String serializeModelState( DatasourceDTO dto ); DatasourceDTO deSerializeModelState( String dtoStr ); List<String> listDatasourceNames(); @Override QueryDatasourceSummary generateQueryDomain( String name, String query, DatabaseConnection connection,
                                                     DatasourceDTO datasourceDTO ); void prepareForSerializaton( Domain domain ); String getDatasourceIllegalCharacters(); @Override GeoContext getGeoContext();  }### Answer:
@Test public void testHasPermission_nullSession() { PentahoSessionHolder.setSession( null ); assertFalse( dswService.hasPermission() ); }