Guest User

Untitled

a guest
Mar 19th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. package functionmocktest.pkg;
  2.  
  3. import ballerina.test;
  4. import ballerina.io;
  5.  
  6. @test:mock {
  7. packageName : "functionmocktest.pkg" ,
  8. functionName : "intAdd"
  9. }
  10. public function mockIntAdd (int a, int b) (int c) {
  11. return a-b;
  12. }
  13.  
  14. public function intAdd (int a, int b) (int) {
  15. return a + b;
  16. }
  17.  
  18. @test:config{}
  19. function testAssertIntEquals () {
  20. int answer = 0;
  21. answer = intAdd(5, 3);
  22. io:println("Function mocking test");
  23. test:assertEquals(answer, 2, "function mocking failed");
  24. }
Add Comment
Please, Sign In to add comment