+
+ @Test
+ public void testFail() throws SQLException, GigiApiException {
+ User assuranceUser = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+ User assuree = User.getById(createVerifiedUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
+
+ // invalid date format
+ assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", "2014-01-blah");
+ // empty date
+ assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", "");
+ // null date
+ assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", null);
+ // null location
+ assuranceFail(assuranceUser, assuree, 10, null, "2014-01-01");
+ // empty location
+ assuranceFail(assuranceUser, assuree, 10, "", "2014-01-01");
+ // date in the future
+ assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", DateSelector.getDateFormat().format(new Date(System.currentTimeMillis() + 2 * 24 * 60 * 60 * 1000)));
+ // location too short
+ assuranceFail(assuranceUser, assuree, 10, "n", "2014-01-01");
+ // points too low
+ assuranceFail(assuranceUser, assuree, -1, "notary-junit-test", "2014-01-01");
+ // points too high
+ assuranceFail(assuranceUser, assuree, 11, "notary-junit-test", "2014-01-01");
+
+ // assure oneself
+ assuranceFail(assuranceUser, assuranceUser, 10, "notary-junit-test", "2014-01-01");
+ // not an assurer
+ assuranceFail(assuree, assuranceUser, 10, "notary-junit-test", "2014-01-01");
+
+ // valid
+ Notary.assure(assuranceUser, assuree, assuree.getName(), assuree.getDoB(), 10, "notary-junit-test", "2014-01-01", AssuranceType.FACE_TO_FACE);
+
+ // assure double
+ assuranceFail(assuranceUser, assuree, 10, "notary-junit-test", "2014-01-01");
+
+ }