Skip to content

Commit bd5bffa

Browse files
committed
fix: Fix refactor fails: UnitOfWork (Traction internal) instead of fflib_SObjectUnitOfWork
1 parent 08a5984 commit bd5bffa

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

fflib/src/classes/fflib_SObjectUnitOfWorkTest.cls

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,13 @@ private with sharing class fflib_SObjectUnitOfWorkTest
349349
private static void testRegisterDirty_DoubleException() {
350350
Opportunity opp = new Opportunity(Id = '00636000005loIj', Name = 'UpdateName');
351351
Opportunity opp2 = new Opportunity(Id = '00636000005loIj', Amount = 250);
352-
UnitOfWork uow = new UnitOfWork(MY_SOBJECTS);
352+
fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(MY_SOBJECTS);
353353
uow.registerDirty(opp);
354354
Boolean exceptionThrown = false;
355355
try {
356356
// Second registration would undo updates of first registration
357357
uow.registerDirty(opp2);
358-
} catch (UnitOfWork.UnitOfWorkException e) {
358+
} catch (fflib_SObjectUnitOfWork.UnitOfWorkException e) {
359359
System.assert(e.getMessage().contains(opp.Id));
360360
exceptionThrown = true;
361361
}
@@ -376,40 +376,16 @@ private with sharing class fflib_SObjectUnitOfWorkTest
376376

377377
Opportunity nameUpdate = new Opportunity(Id = opp.Id, Name = 'UpdateName');
378378
Opportunity amountUpdate = new Opportunity(Id = opp.Id, Amount = 250);
379-
UnitOfWork uow = new UnitOfWork(MY_SOBJECTS);
379+
fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(MY_SOBJECTS);
380380
uow.registerDirty(nameUpdate);
381-
uow.registerDirty(amountUpdate, Opportunity.Amount);
381+
uow.registerDirty(amountUpdate, new List<SObjectField> { Opportunity.Amount } );
382382
uow.commitWork();
383383

384384
opp = [SELECT Name, Amount FROM Opportunity WHERE Id = :opp.Id];
385385
System.assertEquals(opp.Name, nameUpdate.Name);
386386
System.assertEquals(opp.Amount, amountUpdate.Amount);
387387
}
388388

389-
/**
390-
* Try registering a single unupdateable field as dirty in secure mode
391-
*
392-
* Testing:
393-
*
394-
* - exception is thrown
395-
*/
396-
@isTest
397-
private static void testRegisterDirty_field_secure() {
398-
Opportunity opp = new Opportunity(Name = 'test name', StageName = 'Open', CloseDate = System.today());
399-
insert opp;
400-
401-
UnitOfWork uow = new UnitOfWork(MY_SOBJECTS, new AccessConfig());
402-
uow.registerDirty(opp, Opportunity.Id); // Should throw exception because ID is not updatable
403-
404-
Boolean exceptionThrown = false;
405-
try {
406-
uow.commitWork();
407-
} catch (fflib_SecurityUtils.SecurityException e) {
408-
exceptionThrown = true;
409-
}
410-
System.assert(exceptionThrown);
411-
}
412-
413389
/**
414390
* Assert that actual events exactly match expected events (size, order and name)
415391
* and types match expected types

0 commit comments

Comments
 (0)