Sample Test Class Example

By | January 21, 2020

Hi,this program we have show sample test class for apex class

Apex Class

public class TestExample2 {
    public string industry{set;get;}
    public string rating{set;get;}
    public string ownership{set;get;}
    public void callme(){
            rating = 'Warm';
            ownership = 'Public';
            rating = 'Hot';
            ownership = 'Private';

Test Class

private class TestExample2Test {
    static testMethod void testme(){
        TestExample2 t = new TestExample2();
        t.industry = 'Energy';
        system.assertEquals('Warm', t.rating);
        system.assertEquals('Public', t.ownership);
        TestExample2 t2 = new TestExample2();
        system.assertEquals('Hot', t2.rating);
        system.assertEquals('Private', t2.ownership);

Leave a Reply

Your email address will not be published. Required fields are marked *