------=_Part_1902201_1683252520.1363512635975
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Hi,
If you don't know what ValidationResult is, check out
http://www.ovirt.org/ValidationResult
In a gist, I added a new way to test this using JUnit's assertThat syntax:
// Test that validation result is valid
assertThat(someValidation(), isValid());
// Test that validation result is invalid
assertThat(someValidation(), failsWith(VdcBllMessages.SOME_ERROR));
// Test that validation result is invalid and has replacement
assertThat(someValidation(),
both(failsWith(VdcBllMessages.SOME_ERROR)).and(replacements(hasItem(EXPECTED_REPLACEMENT))));
You need to statically import ValidationResultMatchers (and the basic JUnit matchers) for
this to work.
The rest I documented in the aforementioned wiki.
Check out the patch:
http://gerrit.ovirt.org/#/c/13061
Or how to use it:
http://gerrit.ovirt.org/#/c/13062
Regards,
Mike
------=_Part_1902201_1683252520.1363512635975
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<html><head><style type='text/css'>p { margin: 0;
}</style></head><body><div style='font-family: times new
roman,new york,times,serif; font-size: 12pt; color:
#000000'>Hi,<br><br>If you don't know what ValidationResult is,
check out
http://www.ovirt.org/ValidationResult<br><br>In a gist, I added a
new way to test this using JUnit's assertThat syntax:<br><pre>// Test that
validation result is valid
assertThat(someValidation(), isValid());
// Test that validation result is invalid
assertThat(someValidation(), failsWith(VdcBllMessages.SOME_ERROR));
// Test that validation result is invalid and has replacement
assertThat(someValidation(),
both(failsWith(VdcBllMessages.SOME_ERROR)).and(replacements(hasItem(EXPECTED_REPLACEMENT))));
</pre>You need to statically import ValidationResultMatchers (and the basic JUnit
matchers) for this to work.<br><br>The rest I documented in the aforementioned
wiki.<br><br>Check out the patch:
http://gerrit.ovirt.org/#/c/13061<br><br>Or how to use it:
http://gerrit.ovirt.org/#/c/13062<br><br><div><span
name="x"></span>Regards,<br>Mike<span
name="x"></span><br></div><br></div></body></html>
------=_Part_1902201_1683252520.1363512635975--