String adminUsername = "java";
List<ApiKey> apikeys = service.getAPIKeys(adminUsername, adminPassword);
int apikeysLength = apikeys.size();
assertTrue ( "Unable to get api keys", ( apikeysLength > 0));
ApiKey newKey = new ApiKey ( null, "tester", "test@test.com" );
service.createApiKey(newKey, adminUsername, adminPassword);
apikeys = service.getAPIKeys(adminUsername, adminPassword);
boolean foundKey = false;
ListIterator<ApiKey> li = apikeys.listIterator();
while (li.hasNext()) {
ApiKey akey = li.next();
if ( akey.getEmail().equals("test@test.com") && akey.getKey().equals("tester")) {
newKey.setId(akey.getId());
foundKey = true;
}
}
assertTrue ( "New key not created", foundKey );