I have some classes generated from wsdl that I need to use in a software. All things are fine until I try to write a test case that aims to verify the consistence of the response body. The problem here is that the test fails because of different hash codes.
There is no type conversion possible from it.agos.soap.npc16.daticlientepercf.GetDatiDocNewResponse to it.agos.soap.npc16.daticlientepercf.GetDatiDocNewResponse$$EnhancerByMockitoWithCGLIB$$f6fda147
What I want to do is to modify my build.gradle file task where I execute the generating task in order to add a lombok @Data annotation to the generated classes, without modify my wsdl file (I can't do it). This is my wsdl2java task:
task generateClassesFromWsdl(group: 'build', description: 'Generate classes from WSDL') {
inputs.files fileTree(dir: 'src/main/resources/wsdl', include:'**/*.wsdl')
String genSrcDir = "src/generated/java"
outputs.dir genSrcDir
inputs.files.each { file ->
doLast {
OutputStream baos;
javaexec {
println "Generating classes for $file.name"
classpath configurations.wsdl2java
main "org.apache.cxf.tools.wsdlto.WSDLToJava"
args '-encoding', 'UTF-8', '-d', genSrcDir, file
baos = new ByteArrayOutputStream()
errorOutput = new OutputStream() {
void write(int b) {System.err.write(b); baos.write(b) }
void flush() { System.err.flush(); baos.flush() }
void close() { System.err.close(); baos.close() }
}
}
def str = baos.toString()
if (str.contains('Usage : wsdl2java') || str.contains('WSDLToJava Error')) {
throw new TaskExecutionException(tasks[name],
new IOException('Apache CXF WSDLToJava has failed. Please see System.err output.'))
}
}
}
}
I have tried to look on other answers, but I don't find anything useful for my case, how can I handle this issue? Thanks!