Newer Version Available

This content describes an older version of this product. View Latest

Mocking Java Models

This test mocks a Java model. The test function is a placeholder. You would add actual test code here.

1swfobject.registerObject("clippy.codeblock-0", "9");testModelProperties : {
2    mocks : [{
3        type : "MODEL",
4        stubs : [{
5            answers : [{
6                value : {
7                    secret : { value : "<not available>" } ,
8                    integer : { value : 1 },
9                    stringList : { value : [ "early", "on", "time", "late"] }
10                }
11            }]
12        }]                   
13    }],
14    test : function(cmp) {
15        // test code goes here
16    }
17},

This test has a mock object that throws an exception.

1swfobject.registerObject("clippy.codeblock-1", "9");testModelThrowsException : {
2    mocks : [{
3        type : "MODEL",
4        stubs : [{
5            answers : [{
6                error : "org.auraframework.throwable.AuraRuntimeException"
7            }]
8        }]                   
9    }],
10    test : function(cmp) {
11        // test code goes here
12    }
13},