Fix spring test to properly handle failures

Failing test cases weren't not properly handled and instead caused test
to break. Added a test case and verified it works for both JUnit and Spock.