Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f0ab9bd

Browse files
author
Tom Fuda
committed
Fix for unit test failure when test is run in namespace packager org, due to the presence of the namespace prefix in the expected exception messages.
1 parent 2cfdba4 commit f0ab9bd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fflib/src/classes/fflib_ApplicationTest.cls

+4-2
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,16 @@ private class fflib_ApplicationTest
188188
Domain.newInstance(new List<Contact>{ new Contact(LastName = 'TestContactLName') });
189189
System.assert(false, 'Expected exception');
190190
} catch (System.TypeException e) {
191-
System.assertEquals('Invalid conversion from runtime type fflib_ApplicationTest.ContactsConstructor to fflib_SObjectDomain.IConstructable', e.getMessage());
191+
System.assert(Pattern.Matches('Invalid conversion from runtime type \\w*\\.?fflib_ApplicationTest\\.ContactsConstructor to \\w*\\.?fflib_SObjectDomain\\.IConstructable',
192+
e.getMessage()), 'Exception message did not match the expected pattern: ' + e.getMessage());
192193
}
193194

194195
try {
195196
Domain.newInstance(new List<SObject>{ new Contact(LastName = 'TestContactLName') }, Contact.SObjectType);
196197
System.assert(false, 'Expected exception');
197198
} catch (System.TypeException e) {
198-
System.assertEquals('Invalid conversion from runtime type fflib_ApplicationTest.ContactsConstructor to fflib_SObjectDomain.IConstructable2', e.getMessage());
199+
System.assert(Pattern.Matches('Invalid conversion from runtime type \\w*\\.?fflib_ApplicationTest\\.ContactsConstructor to \\w*\\.?fflib_SObjectDomain\\.IConstructable2',
200+
e.getMessage()), 'Exception message did not match the expected pattern: ' + e.getMessage());
199201
}
200202
}
201203

0 commit comments

Comments
 (0)