title: Assert with groovy in SOAPUI
body: <p>New to Groovy and a bit of a novice with coding overall but I'm trying so please bear with me. Apologies in advance if I don't but enough detail as to what I'm trying to achieve here!</p>
  
  <p>I am writing a scripted test in SOAPUI for a SOAP call that has multiple instances of the same named <em>node ("//ns2:AddOnCode")</em>. I have expected results of what values I am expecting to return in the instances of this node. </p>
  
  <p>So far I have created the following which works in terms of it only passes if all of these values are present. But I'd like to take this one step further and get the test to fail if this node is returned with a value that I havent defined.</p>
  
  <p>So if say all these 5 values returned but also a 6th <code>//ns2:AddOnCode</code> value came with say '999' then I'd like this test to fail. </p>
  
  <pre><code>def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
  def holder = groovyUtils.getXmlHolder( messageExchange.responseContent )
  
  assert holder["//ns2:AddOnCode"].contains('029')
  assert holder["//ns2:AddOnCode"].contains('030')
  assert holder["//ns2:AddOnCode"].contains('040')
  assert holder["//ns2:AddOnCode"].contains('083')
  assert holder["//ns2:AddOnCode"].contains('105')
  </code></pre>
  
  <p>Below is my response. You can see there are various instances of AddOnCode and these are what I am intereted in testing. My asserts above succesfully pass as all five of these are present in the response but I need to add a further step to look for any other AddOnCode values that are not in my list of assert values.</p>
  
  <pre><code>                 &lt;ns2:AddOnService&gt;
                      &lt;ns2:AddOnCode&gt;029&lt;/ns2:AddOnCode&gt;
                      &lt;ns2:AddOnDesc&gt;OVERPAYMENT&lt;/ns2:AddOnDesc&gt;
                   &lt;/ns2:AddOnService&gt;
                   &lt;ns2:AddOnService&gt;
                      &lt;ns2:AddOnCode&gt;030&lt;/ns2:AddOnCode&gt;
                      &lt;ns2:AddOnDesc&gt;REWARDS POOL&lt;/ns2:AddOnDesc&gt;
                   &lt;/ns2:AddOnService&gt;
                   &lt;ns2:AddOnService&gt;
                      &lt;ns2:AddOnCode&gt;040&lt;/ns2:AddOnCode&gt;
                      &lt;ns2:AddOnDesc&gt;NON URGENT&lt;/ns2:AddOnDesc&gt;
                   &lt;/ns2:AddOnService&gt;
                   &lt;ns2:AddOnService&gt;
                      &lt;ns2:AddOnCode&gt;083&lt;/ns2:AddOnCode&gt;
                      &lt;ns2:AddOnDesc&gt;EXGRATIA&lt;/ns2:AddOnDesc&gt;
                   &lt;/ns2:AddOnService&gt;
                   &lt;ns2:AddOnService&gt;
                      &lt;ns2:AddOnCode&gt;105&lt;/ns2:AddOnCode&gt;
                      &lt;ns2:AddOnDesc&gt;MISC NON CLAIMABLE&lt;/ns2:AddOnDesc&gt;
                   &lt;/ns2:AddOnService&gt;
                &lt;/ns2:AddOnServices&gt;
  </code></pre>