Activity Forums Salesforce® Discussions How to cover test class for wrapper class in Salesforce?

  • Ravi

    Member
    July 20, 2016 at 10:53 am

    Hi Mohit,

    Here is an Example that will explain how to write unit test for wrapper class.

    Controller:

    public with sharing class WrapperController {
    public class WrapperClass {
    public String name {get; set;}
    }
    }

    Test Class:

    @isTest
    private class TestWrapperController {
    public static void myUnitTest(){
    WrapperController .WrapperClass wrapper= new WrapperController .WrapperClass ();
    wrapper.name = 'Test Wrapper';
    }
    }

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos