-
FEATURED COMPONENTS
First time here? Check out the FAQ!
how to inject session in zk controller from testclass which is @wirevariable in controller.
internally ZK calls Selectors.wireVariables(...)
As you can see from the arguments you can provide a variable resolver that returns a mocked session object when requested. However looking at the actual source code, there's a lot going on especially ZK assuming it lives in a running application (so expect a bit more mocking to be necessary, maybe your scenario is simple enough and "just works" smoothly).
https://github.com/zkoss/zk/blob/master/zk/src/org/zkoss/zk/ui/select/Selectors.java#L130 https://github.com/zkoss/zk/blob/master/zk/src/org/zkoss/zk/ui/select/Selectors.java#L353
If you want an integrated test solution please checkout ZATs our testing library especially for testing pages/controllers/viewmodels without requiring a browser. It simulates user interactions in order to test controller/view model logic.
Asked: 2019-08-01 05:37:45 +0800
Seen: 6 times
Last updated: Aug 01 '19