Skip to content

Commit

Permalink
remove optional affiliation startdate from orcid validation
Browse files Browse the repository at this point in the history
  • Loading branch information
floriangantner committed Jul 24, 2023
1 parent e69f96c commit 37c9796
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -137,9 +136,6 @@ public List<OrcidValidationError> validateFunding(Funding funding) {
@Override
public List<OrcidValidationError> validateAffiliation(Affiliation affiliation) {
List<OrcidValidationError> errors = new ArrayList<OrcidValidationError>();
if (affiliation.getStartDate() == null) {
errors.add(START_DATE_REQUIRED);
}

if (affiliation.getOrganization() == null) {
errors.add(ORGANIZATION_REQUIRED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<OrcidValidationError> 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<OrcidValidationError> errors = validator.validate(qualification);
assertThat(errors, empty());
}

@Test
Expand Down

0 comments on commit 37c9796

Please sign in to comment.