Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package functionmocktest.pkg;
- import ballerina.test;
- import ballerina.io;
- @test:mock {
- packageName : "functionmocktest.pkg" ,
- functionName : "intAdd"
- }
- public function mockIntAdd (int a, int b) (int c) {
- return a-b;
- }
- public function intAdd (int a, int b) (int) {
- return a + b;
- }
- @test:config{}
- function testAssertIntEquals () {
- int answer = 0;
- answer = intAdd(5, 3);
- io:println("Function mocking test");
- test:assertEquals(answer, 2, "function mocking failed");
- }
Add Comment
Please, Sign In to add comment