Thursday, January 17, 2013
Simple Example for Apex Class and Test Class
/*----------- Apex Class---------- */
public class arithmaticCalculationClass{
Integer answer;
public void add(Integer a, Integer b){
answer = a+b;
}
public void subtract(Integer a, Integer b){
answer = a-b;
}
public void multiply(Integer a, Integer b){
answer = a*b;
}
public void division(Integer a, Integer b){
answer = a/b;
}
}
/*-------------Test Class --------------*/
@isTest
public class arithmeticCalculationTestClass{
static testMethod void testMyClass(){
Integer x=20;
Integer y=30;
arithmaticCalculationClass ins = new arithmaticCalculationClass();
ins.add(x,y);
ins.subtract(x,y);
ins.multiply(x,y);
ins.division(x,y);
}
}
Subscribe to:
Post Comments (Atom)
Salesforce - Generate dynamic inner query to fetch parent and related child records
Use Case: In many scenarios, we need to clone the records with related child records. Issue / Limitation: We may simply use the "cl...
-
<apex:page showHeader="false" sidebar="false" controller="ControllerName" standardStylesheets="fals...
-
<script> function myFunction() { var str = "IF((4+2)==5,true,false)"; str = str.replace(/\s/g, '');...
-
Use Case: In many scenarios, we need to clone the records with related child records. Issue / Limitation: We may simply use the "cl...
No comments:
Post a Comment