this.addParameter("mainGroup", "free");
String result = this.executeAction();
assertEquals(Action.INPUT, result);
RemoteResourceLoaderAction action = (RemoteResourceLoaderAction) this.getAction();
assertNotNull(action);
Collection<String> actionErrors = action.getActionErrors();
assertNotNull(actionErrors);
assertEquals(0, actionErrors.size());
Map<String,List<String>> fieldErrors = action.getFieldErrors();
assertNotNull(fieldErrors);
assertEquals(1, fieldErrors.size());
// no well formed url
this.initAction("/do/jpremoteresourceloader/Resource", "save");
this.setUserOnSession("admin");
this.addParameter("ResourceTypeCode", "Image");
this.addParameter("strutsAction", "1");
this.addParameter("descr", "Image");
this.addParameter("alternateName", "Image");
this.addParameter("mainGroup", "free");
this.addParameter("url", "fakeURL");
result = this.executeAction();
assertEquals(Action.INPUT, result);
action = (RemoteResourceLoaderAction) this.getAction();
assertNotNull(action);
actionErrors = action.getActionErrors();
assertNotNull(actionErrors);
assertEquals(0, actionErrors.size());
fieldErrors = action.getFieldErrors();
assertNotNull(fieldErrors);
assertEquals(1, fieldErrors.size());
// not valid url
this.initAction("/do/jpremoteresourceloader/Resource", "save");
this.setUserOnSession("admin");
this.addParameter("ResourceTypeCode", "Image");
this.addParameter("strutsAction", "1");
this.addParameter("descr", "Image");
this.addParameter("alternateName", "Image");
this.addParameter("mainGroup", "free");
this.addParameter("url", "http://www.google.com/entando/resources/static/img/headerLogo_background.jpg");
result = this.executeAction();
assertEquals(Action.INPUT, result);
action = (RemoteResourceLoaderAction) this.getAction();
assertNotNull(action);
actionErrors = action.getActionErrors();
assertNotNull(actionErrors);
assertEquals(0, actionErrors.size());
fieldErrors = action.getFieldErrors();
assertNotNull(fieldErrors);
assertEquals(1, fieldErrors.size());
}