spring - com.liferay.portal.kernel.cache.key.CacheKeyGeneratorUtil.getCacheKeyGenerator -
i try create junit test, probleme exception:
caused by: java.lang.nullpointerexception @ com.liferay.portal.kernel.cache.key.cachekeygeneratorutil.getcachekeygenerator(cachekeygeneratorutil.java:56)
the program can't instantiate the cachekeygenerator -cause defaultcachekeygenerator null!! latter can instantiated when portalcontextloaderlistener.contextinitialized(servletcontextevent servletcontextevent) called... i'm not using portalcontextloaderlistener ... there way solve probleme
depending on you're test, advice typically additional level of indirection. if need depends on larger infrastructure initialized, in case, it's not proper unit test more, rather larger integration test.
adding indirection cache-key should suffice. @ runtime can hook component liferay, @ testing time, return testing values, constants, random results or whatever need test.
Comments
Post a Comment