Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

"java.lang.AbstractMethodError" while accessing content element of Content fragment

Avatar

Level 4

Hi There,

 

I am getting the below error while mocking content fragment in mockito.

 

Error :

java.lang.AbstractMethodError: io.wcm.testing.mock.aem.MockContentFragment_ContentElement_Structured.getValue()Lcom/adobe/cq/dam/cfm/FragmentData;

 

Code Snippet : 

ContentElement content = contentFragment.get().getElement("somefragment");
FragmentData data = content.getValue();
List<String> someFragmentList = Arrays.asList((String[]) data.getValue());

 I can see that contentFragment is not null. And content is also not null but when it is executing "content.getValue()" it is throwing the error.

 

Please do share your thoughts on the same.

 

Thanks,

Ravi Joshi

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
2 Replies

Avatar

Correct answer by
Community Advisor

Hi @ravi_joshi,

ContentElement's getValue() method again is part of unsupported operations - https://github.com/wcm-io/wcm-io-testing/blob/develop/aem-mock/core/src/main/java/io/wcm/testing/moc...

 

Avatar

Level 4

@Vijayalakshmi_S  Thank you. It was really helpful. Now we will try to change the logic accordingly.