"java.lang.AbstractMethodError" while accessing content element of Content fragment | Community
Skip to main content
Ravi_Joshi
Level 4
September 25, 2021
Solved

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

  • September 25, 2021
  • 1 reply
  • 3035 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Vijayalakshmi_S

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/mock/aem/MockContentFragment_ContentElement_Structured.java

 

1 reply

Vijayalakshmi_S
Vijayalakshmi_SAccepted solution
Level 10
September 27, 2021
Ravi_Joshi
Level 4
September 28, 2021

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