}
}
String[] parameterValues = req.getParameterValues("assuredName");
- HashSet<String> data = new HashSet<>(Arrays.asList(parameterValues==null?new String[0]:parameterValues));
+ HashSet<String> data = new HashSet<>(Arrays.asList(parameterValues == null ? new String[0] : parameterValues));
for (int i = 0; i < assureeNames.length; i++) {
selected[i] = data.contains(Integer.toString(assureeNames[i].getId()));
}
toAssure.add(assureeNames[i]);
}
}
+ if (toAssure.size() == 0) {
+ throw new GigiApiException("You must confirm at least one name to verify an account.");
+ }
Notary.assureAll(assurer, assuree, dob, pointsI, location, req.getParameter("date"), type, toAssure.toArray(new Name[toAssure.size()]));
}
public synchronized static void assureAll(User assurer, User assuree, DayDate dob, int awarded, String location, String date, AssuranceType type, Name[] toAssure) throws GigiApiException {
+ if (toAssure.length == 0) {
+ throw new GigiApiException("You must confirm at least one name to verify an account.");
+ }
boolean[] hadLessThan50Points = new boolean[toAssure.length];
boolean hadTotalLessThan100 = assuree.getAssurancePoints() < 100;
for (int i = 0; i < toAssure.length; i++) {
executeSuccess("date=" + validVerificationDateString() + "&location=testcase&certify=1&rules=1&assertion=1&points=10");
}
+ @Test
+ public void testAssureFormEmpty() throws IOException {
+ URLConnection uc = buildupAssureFormConnection(true);
+ uc.getOutputStream().write(("date=" + validVerificationDateString() + "&location=testcase&rules=1&assertion=1&points=10").getBytes("UTF-8"));
+ uc.getOutputStream().flush();
+ String data = IOUtils.readURL(uc);
+ assertThat(data, hasError());
+ }
+
@Test
public void testAssureFormContanisData() throws IOException {
URLConnection uc = buildupAssureFormConnection(true);