neowit / apexmock Goto Github PK
View Code? Open in Web Editor NEWforce.com Mock data and fixtures for Apex Unit Tests
force.com Mock data and fixtures for Apex Unit Tests
The examples in the readme have maps without type variables. I was hoping Apex could infer, but it doesn't seem to be the case.
An example from the readme what won't compile:
Account acc1 = (Account)Mock.one('Account',
new Map{ 'MyField__c' => 'some-value', 'OtherField__c' => 123}, true);
This will:
Account acc1 = (Account)Mock.one('Account',
new Map<String, Object> { 'MyField__c' => 'some-value', 'OtherField__c' => 123}, true);
MockUtil.testGetProfile searches for the profile 'System Administrator'. This can be different if the user who is testing has another language selected.
possible solution :
User u = [Select ID, LanguageLocaleKey FROM User WHERE Id =: UserInfo.getUserId() LIMIT 1];
u.LanguageLocaleKey = 'en_US';
update u;
System.runAs(u) {
//every org has System Administrator profile so we can reliably test that it exists
System.assertNotEquals(null, MockUtils.getProfile('System Administrator'), 'System Administrator profile always exists');
}
Loving this framework!
But after installing this new version I got a lot of save errors on the MockDBTest. It seems that there is a query function missing in the MockDB class ?
Hi Andrey,
just to let you know, if person accounts are active, the creation of accounts will fail.
In the MockStandard the name field is provided as default. But a personaccount has no name but a lastname that is required.
You can detect person account by the field isPersonAccount of course. Maybe it fits somewhere...
anyhow, many thanks for the wonderful framework
Andries
When creating more than 100 objects you will receive this error:
System.LimitException: Too many fields describes
This isn't required, but it's good practice.
Especially since salesforce now requires this in classes with newer metadata types.
Affected files:
MockUtils.cls
The variable dependsOn in Mock.populateFieldValues() is redefined, even though it's final. The apex compiler doesn't catch this, but it fails when executed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.