I have a page which displays an entity that belongs to another package. In order not have a hard dependency to this package, I build a wrapper object and make this wrapper object accessible to the page via a custom controller.
So it looks like this:
public class UsageStatsWrapper {
public Decimal SummActions{get;set;} //
public Decimal AM_Details{get;set;} //
UsageStatsWrapper(SObject objectInstance) {
this.SummActions = (Decimal)objectInstance.get('OTHERPCK__Actions__c');
this.AM_Details = (Decimal)objectInstance.get('OTHERPCK__AM_Details__c');
// ...
// ...
I want to test this (have to, to make the 75%).
The problem is I can't instantiate the SOBject in my test code. I also, can't really do something like:
Schema.getGlobalDescribe().get(ObjectName).newSObject() ;
As that can ends up putting a dependency to the other package.
Any tips?