Hi All,
public abstract class SampleUse extends WCMUse {
protected List<String> getList(ValueMap resourceProperties) {
String propertyName = get(Constants.NAME, String.class);
and so on...
#1] This is like a utility class and has various methods in it, invoked from various places/components. But the requirement is to invoke these methods from SampleUseTest.java even though components are invoking the same code.
#2] The "get" is a WCMUse class, which retrieves arguments passed via sightly [for instance : @ property='Path'].
#3] From the java code corresponding to the component if "when(bindings.get("property")).thenReturn("Path");" is used then it works fine.
#4] However, when I try the same thing from the above util class, it throws NUllpointer/WCMUse Exception and breaking here.
Any thoughts/pointers on this will be really really helpful.
Views
Replies
Total Likes
Hi All,
Any thoughts on this will be helpful.
Read this article that talks about this subject: http://aempodcast.com/2015/testing/unit-testing-wcmuse-classes-using-mockito/#.V3Q93_krJaQ
Alos - look at this article - there is JUNIT information here:
https://helpx.adobe.com/experience-manager/using/first-arch10.html
Hi All,
An additional observation as below :
I can see that when any of the WCMUse related methods[https://docs.adobe.com/docs/en/aem/6-0/develop/ref/javadoc/com/adobe/cq/sightly/WCMUse.html#getResou...()] is being used in the Junit, its failing with Nullpointerexception for those and throwing WCMUseException. However, from other component junit test classes when the same method[i.e, getList() mentioned above] is called it is working. Not sure where exactly I am going wrong.
Hi All,
Additional observation:
When I "debug as Junit test", just for this junit class it throws message as seen in screenshot. If i click ok for 3-4 times it then goes to debug mode. Did run couple of builds, restarted eclipse, manually placed core bundle[having java code] into system/console/configMgr, but still the same. Has this got anything to do with the errors its throwing for WCMUse methods.
Views
Likes
Replies
Views
Likes
Replies