@Test public void test_exception_thrown_when_field_not_set() throws IllegalAccessException { Class clazz = WctDepositParameter.class; WctDepositParameter parameter = new WctDepositParameter(); Field[] fields = clazz.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; field.setAccessible(true); field.set(parameter, "a value"); try { parameter.isValid(); if (isNotLastFieldOfArray(fields, i)) fail("exception should have been thrown"); } catch (WctDepositParameterValidationException ex) { } } parameter.isValid(); }
public void isValid() throws WctDepositParameterValidationException { isFieldValid("PDS URL", pdsUrl); isFieldValid("FTP host", ftpHost); isFieldValid("FTP user name", ftpUserName); isFieldValid("FTP password", ftpPassword); isFieldValid("DPS WSDL URL", dpsWsdlUrl); isFieldValid("DPS institution", dpsInstitution); isFieldValid("DPS user name", dpsUserName); isFieldValid("DPS password", dpsPassword); isFieldValid("material flow ID", materialFlowId); isFieldValid("producer ID", producerId); }
WctDepositParameter { public void isValid() throws WctDepositParameterValidationException { isFieldValid("PDS URL", pdsUrl); isFieldValid("FTP host", ftpHost); isFieldValid("FTP user name", ftpUserName); isFieldValid("FTP password", ftpPassword); isFieldValid("DPS WSDL URL", dpsWsdlUrl); isFieldValid("DPS institution", dpsInstitution); isFieldValid("DPS user name", dpsUserName); isFieldValid("DPS password", dpsPassword); isFieldValid("material flow ID", materialFlowId); isFieldValid("producer ID", producerId); } }
WctDepositParameter { public void isValid() throws WctDepositParameterValidationException { isFieldValid("PDS URL", pdsUrl); isFieldValid("FTP host", ftpHost); isFieldValid("FTP user name", ftpUserName); isFieldValid("FTP password", ftpPassword); isFieldValid("DPS WSDL URL", dpsWsdlUrl); isFieldValid("DPS institution", dpsInstitution); isFieldValid("DPS user name", dpsUserName); isFieldValid("DPS password", dpsPassword); isFieldValid("material flow ID", materialFlowId); isFieldValid("producer ID", producerId); }  }
WctDepositParameter { public void isValid() throws WctDepositParameterValidationException { isFieldValid("PDS URL", pdsUrl); isFieldValid("FTP host", ftpHost); isFieldValid("FTP user name", ftpUserName); isFieldValid("FTP password", ftpPassword); isFieldValid("DPS WSDL URL", dpsWsdlUrl); isFieldValid("DPS institution", dpsInstitution); isFieldValid("DPS user name", dpsUserName); isFieldValid("DPS password", dpsPassword); isFieldValid("material flow ID", materialFlowId); isFieldValid("producer ID", producerId); }  void isValid(); String getPdsUrl(); void setPdsUrl(String pds_url); String getFtpHost(); void setFtpHost(String ftpHost); String getFtpUserName(); void setFtpUserName(String ftpUserName); String getFtpPassword(); void setFtpPassword(String ftpPassword); String getFtpDirectory(); void setFtpDirectory(String ftpDirectory); String getDpsWsdlUrl(); void setDpsWsdlUrl(String dpsWsdlUrl); String getDpsInstitution(); void setDpsInstitution(String dpsInstitution); String getDpsUserName(); void setDpsUserName(String dpsUserName); String getDpsPassword(); void setDpsPassword(String dpsPassword); String getMaterialFlowId(); void setMaterialFlowId(String materialFlowId); String getProducerId(); void setProducerId(String producerId); String getOmsOpenAccess(); void setOmsOpenAccess(String omsOpenAccess); String getOmsPublishedRestricted(); void setOmsPublishedRestricted(String omsPublishedRestricted); String getOmsUnpublishedRestrictedByLocation(); void setOmsUnpublishedRestrictedByLocation(String omsUnpublishedRestrictedByLocation); String getOmsUnpublishedRestrictedByPersion(); void setOmsUnpublishedRestrictedByPersion(String omsUnpublishedRestrictedByPersion); String getDCTitleSource(); void setDCTitleSource(String setDCTitleSource); }
WctDepositParameter { public void isValid() throws WctDepositParameterValidationException { isFieldValid("PDS URL", pdsUrl); isFieldValid("FTP host", ftpHost); isFieldValid("FTP user name", ftpUserName); isFieldValid("FTP password", ftpPassword); isFieldValid("DPS WSDL URL", dpsWsdlUrl); isFieldValid("DPS institution", dpsInstitution); isFieldValid("DPS user name", dpsUserName); isFieldValid("DPS password", dpsPassword); isFieldValid("material flow ID", materialFlowId); isFieldValid("producer ID", producerId); }  void isValid(); String getPdsUrl(); void setPdsUrl(String pds_url); String getFtpHost(); void setFtpHost(String ftpHost); String getFtpUserName(); void setFtpUserName(String ftpUserName); String getFtpPassword(); void setFtpPassword(String ftpPassword); String getFtpDirectory(); void setFtpDirectory(String ftpDirectory); String getDpsWsdlUrl(); void setDpsWsdlUrl(String dpsWsdlUrl); String getDpsInstitution(); void setDpsInstitution(String dpsInstitution); String getDpsUserName(); void setDpsUserName(String dpsUserName); String getDpsPassword(); void setDpsPassword(String dpsPassword); String getMaterialFlowId(); void setMaterialFlowId(String materialFlowId); String getProducerId(); void setProducerId(String producerId); String getOmsOpenAccess(); void setOmsOpenAccess(String omsOpenAccess); String getOmsPublishedRestricted(); void setOmsPublishedRestricted(String omsPublishedRestricted); String getOmsUnpublishedRestrictedByLocation(); void setOmsUnpublishedRestrictedByLocation(String omsUnpublishedRestrictedByLocation); String getOmsUnpublishedRestrictedByPersion(); void setOmsUnpublishedRestrictedByPersion(String omsUnpublishedRestrictedByPersion); String getDCTitleSource(); void setDCTitleSource(String setDCTitleSource);  }