You need to sign in to do that
Don't have an account?
Che SFDC
Need help with Test Class
Dear all, I`m new to Apex programming and I need help with test class. Below is my apex class and i`m not getting any test coverage on this class. Can someone please help me with test code to get me started? Thanks in advance.
public with sharing class Example { String oppId; String ownerId; private final Opportunity Oppty; public Example (ApexPages.StandardController stdController) { oppId = stdController.getId(); Oppty = (Opportunity) stdController.getRecord(); ownerId = oppty.OwnerId; oppty.StageName = 'Identified Opportunity'; oppty.Probability = 0; } public transient Map<String, Decimal> probabilityStageNameMap; public PageReference changeStageName() { if (probabilityStageNameMap == null) { probabilityStageNameMap = new Map<String, Decimal>(); for (OpportunityStage oppStage : [Select MasterLabel, DefaultProbability From OpportunityStage]) { probabilityStageNameMap.put(oppStage.MasterLabel, oppStage.DefaultProbability); } } if (probabilityStageNameMap.containsKey(Oppty.StageName)) { Oppty.Probability = probabilityStageNameMap.get(Oppty.StageName); } return null; } public PageReference dosave() { insert oppty; return new PageReference('/' + 'apex/OppNEWLayout?id= + oppty.id'); } }
Try with below code and let me know any issue .
Thanks
Manoj
All Answers
Try with below code and let me know any issue .
Thanks
Manoj