fork download
  1.  
  2. Nav Singh
  3. Jan 25, 2022, 10:05 AM
  4. @isTest
  5. public class SampleTest {
  6.  
  7. @isTest
  8. static void Summary() {
  9. Sample s = new Sample();
  10. s.xvalue= 5;
  11. s.yvalue = 4;
  12. s.add();
  13. s.div();
  14. s.mul();
  15. s.sub();
  16.  
  17.  
  18. }
  19. }
  20. Apex class
  21. public class Sample {
  22. public Integer xvalue {get;set;}
  23. public Integer yvalue {get;set;}
  24. public Integer result {get;set;}
  25. public string operation {get;set;}
  26.  
  27. public Integer sub() {
  28. result = xvalue-yvalue;
  29. operation = 'Subtraction';
  30. return null;
  31. }
  32. public Integer add() {
  33. result = xvalue+yvalue;
  34. operation = 'Addition';
  35. return null;
  36. }
  37. public Integer mul() {
  38. result = xvalue*yvalue;
  39. operation = 'Multiplication';
  40. return null;
  41. }
  42. public Integer div() {
  43. result = xvalue/yvalue;
  44. operation = 'Divison';
  45. return null;
  46. }
  47.  
  48.  
  49. }
Success #stdin #stdout #stderr 0.01s 9924KB
stdin
Standard input is empty
stdout
Object: nil error: did not understand #Singh
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject(Object)>>doesNotUnderstand: #Singh (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:2)
Object: 25 error: did not understand #,
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
SmallInteger(Object)>>doesNotUnderstand: #, (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:3)
stderr
./prog:3: expected expression