I don't understand how this Integration test is failing in Grails <p>This is a basic mock of a web service where a Patient object is checked for eligibility. I have included the console output to show the test failing.</p> <p>When I run this test in the groovyConsole it passes. </p> <p>Basic Patient Class:</p> <pre><code>class Patient { String firstName, lastName Date dateOfBirth } </code></pre> <p>Create the patient object:</p> <pre><code>Patient p1 = new Patient( firstName: 'Mike', lastName: 'Smith', dateOfBirth: new GregorianCalendar(1968, Calendar.AUGUST, 23).time ).save(flush: true, failOnError: true) </code></pre> <p>Mock setup: </p> <p>This test normally queries a web service. I need to mock the service due to firewall issues. I build a tree that replicates the service call.</p> <pre><code>def eligibilityMock(Patient pat) { def tree = { -&gt; return [:].withDefault{ tree() } } def member = tree() if (pat.firstName == "Mike" &amp;&amp; pat.lastName == "Smith") { member.memberInfo.memberDetails.value.memberFirstName.value = 'Mike' } member } </code></pre> <p>I call the mocked service </p> <pre><code>//def memberInfo = eligibilityMock(p1) def member = humanaEligibilityMock(p1).memberInfo </code></pre> <p>I expect the firstName to match</p> <pre><code>assert p1.firstName == memberInfo.memberDetails?.value?.memberFirstName?.value </code></pre> <p>It seem the values match up, however the assertion fails. </p> <pre><code> p1.firstName == memberInfo.memberDetails?.value?.memberFirstName?.value | | | | | | | Mike | | | | [value:[:]] [:] | | | [memberFirstName:[value:[:]]] | | [value:[memberFirstName:[value:[:]]]] | [memberInfo:[memberDetails:[value:[memberFirstName:[value:Mike] false </code></pre>