Java – Liferay JUnit mockito test
•
Java
I'm trying to test my Liferay portlet plug-in code using JUnit and mockito At present, I am simulating the service implementation to return simulated data and test the function
The problem I face is that I need to test some code with attributes: propsutil Get ("somekey"), but when I run it as a stand-alone JUnit test, propsutil will not read from any properties file Is there any way to read tests from the Liferay properties (portal *. Properties) file without changing the source code?
Solution
I use the following methods:
>My testclass extends baseservicetestcase (available in Liferay SRC) > portal test Properties are kept in the test folder (with test values). > Run test cases
In this case, Liferay will load all properties and spring initialization
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码