How to call Java code from soapUI?
Hi - this may be a Groovy question rather than a real soapUI question, but soapUI is the reason I am now digging into Groovy, so please bear with me:
I am trying to get a bit more information why one of my regular expressions doesn't match. Unfortunately, a statement like "assert response =~ pattern" returns essentially just yields a thumbs up/down result without any indication whatsoever why something didn't match.
I was thus trying to use some good, ol' Java code to get a bit more feedback. The PatternSyntaxException that Pattern throws if a match fails would allow to get a bit more details (error index, etc.). So I was trying a code snippet like the below:
def matches = false try { log.info('1') matches = java.util.regex.Pattern.matches(pattern, response) log.info('2: ' + matches) } catch (java.util.regex.PatternSyntaxException psx) { log.info(psx.getMessage()) } catch (Exception ex) { log.info(ex) } assert matches
Why does this always only reach the "log.info('1')" statement and then ends in an "Error: null" popup?
I though, one of the big advantages of Groovy is that I can use plain Java code whenever I want or need to. Why does this not work here? What am I missing?