Linked Questions

0
votes
1answer
4k views

Custom metadata type code coverage in test class [duplicate]

I Have a map of custom metadata type Map<String,error_mdt> error error=[select id, DeveloperName from error_mdt].How can we Use meta data types in test class to get code coverage. I have ...
0
votes
1answer
1k views

Test class for Custom Metadata Types [duplicate]

I have a custom metadata type with one field(text) which holds a single value. I am referring this field value in the Lightning Component to pass it as a URL. Apex controller: @AuraEnabled public ...
0
votes
1answer
105 views

Apex test coverage for custom metadata type [duplicate]

Question: How can a unit test cover the throw exception part? List<abc__mdt> settings = [ SELECT DeveloperName, Value__c FROM Setting__mdt WHERE ...
73
votes
3answers
29k views

What is the difference between Custom Settings and Custom Metadata Types

Summer '15 is going to include the GA release of Custom Metadata Types. See Introducing custom metadata types: the app configuration engine for Force.com Are Custom Metadata Types intended as a ...
31
votes
5answers
49k views

Insert Custom Metadata for Unit Test

I have a controller that is querying custom metadata. I'm attempting to write unit tests to test the queries. Is it possible to insert test custom metadata for the purposes of unit tests?
3
votes
1answer
2k views

How to Make Metadata.Operation deploy work?

Did anyone tried to new Salesforce Summer 17 feature to deploy metadata records and layouts by Apex Code? I tried to use this feature to update custom metadata record and it fails for me. I just ...
1
vote
1answer
525 views

system.runas and user's time zone

I am writing a test class for testing an API, which populates the value of an iVAR with the logged in user's time zone. In real time, this API works fine. If the logged in User's time zone is EST, I ...
2
votes
1answer
373 views

Testing Metadata Using Mock Call Outs to Static Resources

I have a class that is called before the handler method of a trigger to check and see if a Custom Metadata Field is checked and therefore the code in the trigger handler should not be run. I can ...
0
votes
2answers
200 views

insertion fail due to custom metadata in handler

Here is the handler which contains meta data Petrol_Price__mdt due to which my record in test class is not getting inserted. public with sharing class HandlerExpenseManagement{ public void ...
0
votes
1answer
112 views

What is the proper way to enable SeeAllData when working with Event Monitoring Big Objects?

I'm using Event Monitoring & would like to use @SeAllData = true in my unit tests, so that I can leverage pre-existing logs. However, when I enable it & query an Event Monitoring object, I ...
1
vote
1answer
72 views

How to create a unit test for custom objects meta?

We are building a package that creates custom setting with reference to custom objects. Then we use settings to create records for these custom objects. How we can create unit test in the package for ...
1
vote
0answers
31 views

How can Product2.StockKeepingUnit already exist in a test? [duplicate]

I'm trying to create some Apex tests. Of course I am NOT using SeeAllData=true. When I try to insert some instances of Product2, even though I've inserted none before, I get: System.DmlException: ...