XMLUnit code does not compile in keyword but compiles in testcase

Hi,

I’ve the following code in keyword and it won’t compile but if I put the same code in testcase it compiles. What’s wrong with keyword?

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import org.custommonkey.xmlunit.DetailedDiff;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.Difference;
import org.custommonkey.xmlunit.DifferenceConstants;
import org.custommonkey.xmlunit.DifferenceListener;
import org.custommonkey.xmlunit.XMLUnit;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
import com.kms.katalon.core.annotation.Keyword

Everything in bold does not compile. Thanks in advance.

// Ignore namespace
differ.overrideDifferenceListener(new DifferenceListener() {
@Override
public int differenceFound(Difference diff) {
if (diff.getId() == DifferenceConstants.NAMESPACE_PREFIX_ID) {
return RETURN_IGNORE_DIFFERENCE_NODES_IDENTICAL;
}
return RETURN_ACCEPT_DIFFERENCE;
}
@Override
public void skippedComparison(Node arg0, Node arg1) { }
});

Likely that your test case and keyword have different import statements.

Possibly your test case has this:

import static org.custommonkey.xmlunit.DifferenceListener.*;

But your keyword doesn’t.

I finally figured it out, the issue was not with the import statement. Both imports were copy cut pasted. Issue was with the static method, once I removed the word static from the method signature it worked.

Thanks for a quick response.