+ // As a final check, make sure there aren't multiple "error" array elements. Unfortunately,
+ // the call above to getAsJsonObject().entrySet() will out duplicate "error" elements. So
+ // we'll use regex on the json string to verify this.
+
+ Matcher matcher = Pattern.compile( "\"error\"[ ]*:[ ]*\\[", Pattern.DOTALL ).matcher( bos.toString() );
+ assertTrue( "Expected 1 \"error\" element", matcher.find() );
+ assertFalse( "Found multiple \"error\" elements", matcher.find() );
+