Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-baillie-ortoo committed Mar 29, 2022
1 parent bd555da commit 0ad54fd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ public inherited sharing class ApplicationMockRegistrar
* @param Type The type (interface) for which the mock app logic class should be registered
* @return Amoss_Instance The controller for the mock Service
*/
// TODO: test
public static Amoss_Instance registerMockAppLogic( Type appLogicType )
{
Amoss_Instance mockAppLogicController = new Amoss_Instance( appLogicType );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ public virtual inherited sharing class DmlRecord
return this.recordToDml;
}

// TODO: document / test
/**
* Returns the Id that is on the SObject this will perform the DML against.
* Is populated after an insert has been performed
*
* @return Id The Id on the SObject
*/
public Id getSobjectId()
{
return this.recordToDml.Id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ private without sharing class DmlRecordTest
ortoo_Asserts.assertContains( 'DmlRecord constructor called with a null recordToDml', exceptionMessage, 'constructor, when given null, will throw an exception' );
}

@isTest
private static void getSobjectId_willReturnTheIdOfTheSobject() // NOPMD: Test method name format
{
Id accountId = TestIdUtils.generateId( Account.sobjectType );

DmlRecord dmlRecord = new DmlRecord( new Account( Id = accountId ) );

Test.startTest();
Id got = dmlRecord.getSobjectId();
Test.stopTest();

System.assertEquals( accountId, got, 'getSobjectId, will return the Id of the SObject' );
}

@isTest
private static void addChildContect_whenCalled_willInitialiseADefinerForThatType() // NOPMD: Test method name format
{
Expand Down

0 comments on commit 0ad54fd

Please sign in to comment.