diff --git a/dspace-api/src/main/java/org/dspace/orcid/model/validator/impl/OrcidValidatorImpl.java b/dspace-api/src/main/java/org/dspace/orcid/model/validator/impl/OrcidValidatorImpl.java index ca51f170ab56..c9888623d0e1 100644 --- a/dspace-api/src/main/java/org/dspace/orcid/model/validator/impl/OrcidValidatorImpl.java +++ b/dspace-api/src/main/java/org/dspace/orcid/model/validator/impl/OrcidValidatorImpl.java @@ -23,7 +23,6 @@ import static org.dspace.orcid.model.validator.OrcidValidationError.ORGANIZATION_NAME_REQUIRED; import static org.dspace.orcid.model.validator.OrcidValidationError.ORGANIZATION_REQUIRED; import static org.dspace.orcid.model.validator.OrcidValidationError.PUBLICATION_DATE_INVALID; -import static org.dspace.orcid.model.validator.OrcidValidationError.START_DATE_REQUIRED; import static org.dspace.orcid.model.validator.OrcidValidationError.TITLE_REQUIRED; import static org.dspace.orcid.model.validator.OrcidValidationError.TYPE_REQUIRED; @@ -137,9 +136,6 @@ public List validateFunding(Funding funding) { @Override public List validateAffiliation(Affiliation affiliation) { List errors = new ArrayList(); - if (affiliation.getStartDate() == null) { - errors.add(START_DATE_REQUIRED); - } if (affiliation.getOrganization() == null) { errors.add(ORGANIZATION_REQUIRED); diff --git a/dspace-api/src/test/java/org/dspace/orcid/model/validator/OrcidValidatorTest.java b/dspace-api/src/test/java/org/dspace/orcid/model/validator/OrcidValidatorTest.java index c64aab756f44..0c818a6bb033 100644 --- a/dspace-api/src/test/java/org/dspace/orcid/model/validator/OrcidValidatorTest.java +++ b/dspace-api/src/test/java/org/dspace/orcid/model/validator/OrcidValidatorTest.java @@ -18,8 +18,8 @@ import static org.dspace.orcid.model.validator.OrcidValidationError.ORGANIZATION_CITY_REQUIRED; import static org.dspace.orcid.model.validator.OrcidValidationError.ORGANIZATION_COUNTRY_REQUIRED; import static org.dspace.orcid.model.validator.OrcidValidationError.ORGANIZATION_NAME_REQUIRED; +import static org.dspace.orcid.model.validator.OrcidValidationError.ORGANIZATION_REQUIRED; import static org.dspace.orcid.model.validator.OrcidValidationError.PUBLICATION_DATE_INVALID; -import static org.dspace.orcid.model.validator.OrcidValidationError.START_DATE_REQUIRED; import static org.dspace.orcid.model.validator.OrcidValidationError.TITLE_REQUIRED; import static org.dspace.orcid.model.validator.OrcidValidationError.TYPE_REQUIRED; import static org.hamcrest.MatcherAssert.assertThat; @@ -43,6 +43,7 @@ import org.orcid.jaxb.model.common.WorkType; import org.orcid.jaxb.model.v3.release.common.Amount; import org.orcid.jaxb.model.v3.release.common.DisambiguatedOrganization; +import org.orcid.jaxb.model.v3.release.common.FuzzyDate; import org.orcid.jaxb.model.v3.release.common.Organization; import org.orcid.jaxb.model.v3.release.common.OrganizationAddress; import org.orcid.jaxb.model.v3.release.common.PublicationDate; @@ -579,11 +580,22 @@ public void testValidFunding() { public void testWithAffiliationValidationEnabled() { Qualification qualification = new Qualification(); - qualification.setOrganization(buildValidOrganization()); + qualification.setStartDate(FuzzyDate.valueOf(2024,7,24)); List errors = validator.validate(qualification); assertThat(errors, hasSize(1)); - assertThat(errors, containsInAnyOrder(START_DATE_REQUIRED)); + assertThat(errors, containsInAnyOrder(ORGANIZATION_REQUIRED)); + } + + @Test + public void testValidAffiliation() { + + Qualification qualification = new Qualification(); + qualification.setOrganization(buildValidOrganization()); + qualification.setStartDate(FuzzyDate.valueOf(2024,7,24)); + + List errors = validator.validate(qualification); + assertThat(errors, empty()); } @Test