ParameterFormData extends ParameterNoBody { @Override public void validate() throws APIRestGeneratorException { String errorString = null ; if (ConstantsCommon.TYPE_FILE.equals(this.getType()) && !this.consumes.contains(ConstantsInput.CON_MULTIPART_FORM_DAT) && !this.consumes.contains(ConstantsInput.CON_APP_X_WWW_FORM_URL)) { errorString = "The 'name' field (with the value '" + this.getName() + "') needs some (or both) of the following types in the consumes definition: " + ConstantsInput.CON_MULTIPART_FORM_DAT + ConstantsCommon.STRING_COMMA + ConstantsCommon.STRING_BLANK + ConstantsInput.CON_APP_X_WWW_FORM_URL ; } else if (this.getType() == null) { errorString = "The 'name' field (with the value '" + this.getName() + "') needs a 'type'" ; } else if (this.isAutoInjected()) { errorString = "Auto Injection is not implemented for form-data parameters" ; } if (errorString != null) { ParameterFormData.LOGGER.error(errorString) ; throw new APIRestGeneratorException(errorString) ; } } ParameterFormData(final String name,
							 final String alias,
							 final String description,
							 final String required,
							 final String type,
							 final Set<String> consumes,
							 final String autoInjected); @Override void validate(); @Override String getClassName();  }
@Test(expected = APIRestGeneratorException.class) public void invalidParameterTypeNull() throws APIRestGeneratorException { final ParameterFormData parameterFormData = new ParameterFormData(ConstantsTest.NAME, ConstantsTest.ALIAS, ConstantsTest.DESCRIPTION, ConstantsTest.REQUIRED, null, ConstantsTest.CONSUMES_MULTIPAR, ConstantsTest.AUTO_INJECTED) ; parameterFormData.validate() ; }
@Test(expected = APIRestGeneratorException.class) public void invalidParameterAutoInjectedTrue() throws APIRestGeneratorException { final ParameterFormData parameterFormData = new ParameterFormData(ConstantsTest.NAME, ConstantsTest.ALIAS, ConstantsTest.DESCRIPTION, ConstantsTest.REQUIRED, ConstantsCommon.TYPE_FILE, ConstantsTest.CONSUMES_MULTIPAR, "true") ; parameterFormData.validate() ; }