Hello, I have a component implementation GlossaryTransformation.java <https://github.com/xwiki-contrib/application-glossary/blob/master/application-glossary-api/src/main/java/org/xwiki/contrib/glossary/internal/GlossaryTransformation.java>. So it has two methods List<String> getGlossaryEntries() and transform(Block block, TransformationContext context) in it. So, I have a test file https://pastebin.com/NixuBMjD for this component. Here I am trying to mock the behavior of getGlossaryEntries method by putting strings ("glossaryEntry1" and "glossaryEntry2"). And then implementing "when(this.glossaryTransformation.getGlossaryEntries()).thenReturn(mockArrayList);" but this line somehow shows NullPointerException.
On searching on StackOverflow, I found that this is happening because the object of "glossaryTransfromation" is not created, but only a reference is created. So, I tried to put glosaaryTransformation = "mock(GlossaryTransformation.class)" in the code. Yes, the above error was resolved, but the line "Parser parser = this.mocker.getInstance(Parser.class, "xwiki/2.1");" gave an error " ComponentLookupException: Can't find descriptor for the component [role = [interface org.xwiki.rendering.parser.Parser] hint = [xwiki/2.1]]" . Is there a better way to achieve this? Or I think a better approach can be to put the Query method (getGlossaryEntries) of GlossarryTranformation.java in a separate class and then create a mock object for that class and then run the test? Thanks -Sarthak Gupta

