Skip to content

Commit

Permalink
Fix message reference in test & adopt single approach to UTIL_Permiss…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
npsp-reedestockton committed Sep 23, 2023
1 parent 9af64e6 commit 97c5ada
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
22 changes: 1 addition & 21 deletions force-app/main/default/classes/BDI_DataImportDeleteBTN_CTRL.cls
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ public with sharing class BDI_DataImportDeleteBTN_CTRL {
@TestVisible
private List<DataImport__c> dataImports;

public Boolean canRead {
get {
if(this.canRead == null) {
this.canRead = this.checkRead();
}
return this.canRead;
}
private set;
}

public Boolean canDelete {
get {
if(this.canDelete == null) {
Expand All @@ -66,16 +56,6 @@ public with sharing class BDI_DataImportDeleteBTN_CTRL {
private set;
}

public UTIL_Permissions perms {
get {
if(this.perms == null) {
this.perms = new UTIL_Permissions();
}
return this.perms;
}
private set;
}

/** @description Controller constructor */
public BDI_DataImportDeleteBTN_CTRL() {}

Expand Down Expand Up @@ -113,7 +93,7 @@ public with sharing class BDI_DataImportDeleteBTN_CTRL {

public Boolean checkRead() {
Set<SObjectField> findFields = new Set<SObjectField>{DataImport__c.Status__c.getDescribe().getSobjectField()};
return perms.canRead(DataImport__c.SObjectType, findFields);
return UTIL_Permissions.getInstance().canRead(DataImport__c.SObjectType, findFields);
}

private void displayAccessError() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
class BDI_DataImportDeleteBTN_TEST {

/** @description Error message returned when user does not have Delete permission on the SObject */
static String INSUFFICIENT_ACCESS_ERROR_MSG = System.Label.commonAccessErrorMessage;
static String INSUFFICIENT_ACCESS_ERROR_MSG = 'INSUFFICIENT_ACCESS_OR_READONLY';

/** @description Static method executed before each test method is run */
static {
Expand Down

0 comments on commit 97c5ada

Please sign in to comment.