diff --git a/src/main/java/org/filteredpush/qc/date/DwCEventDQ.java b/src/main/java/org/filteredpush/qc/date/DwCEventDQ.java index f9c67b0..bd9e491 100644 --- a/src/main/java/org/filteredpush/qc/date/DwCEventDQ.java +++ b/src/main/java/org/filteredpush/qc/date/DwCEventDQ.java @@ -2151,18 +2151,18 @@ public static DQResponse amendmentEventFromEventdate( * #84 Validation SingleRecord Conformance: year outofrange * * Provides: VALIDATION_YEAR_INRANGE - * Version: 2022-03-22 + * Version: 2022-06-17 * - * Parameters: bdq:earliestDate="1500"; bdq:latestDate=current year + * Parameters: bdq:earliestDate="1582"; bdq:latestDate=current year * * @param year the provided dwc:year to evaluate - * @param bdq:earliestDate integer for lower bound of range of in range years, if null 1600 will be used. + * @param bdq:earliestDate integer for lower bound of range of in range years, if null 1582 will be used. * @param bdq:latestDate integer for upper bound of range of in range years, if null current year will be used. * @return DQResponse the response of type ComplianceValue to return */ @Validation(label="VALIDATION_YEAR_INRANGE", description="Is the value of dwc:year within the Parameter range?") @Provides("ad0c8855-de69-4843-a80c-a5387d20fbc8") - @ProvidesVersion("https://rs.tdwg.org/bdq/terms/ad0c8855-de69-4843-a80c-a5387d20fbc8/2022-03-22") + @ProvidesVersion("https://rs.tdwg.org/bdq/terms/ad0c8855-de69-4843-a80c-a5387d20fbc8/2022-06-17") public static DQResponse validationYearInrange( @ActedUpon(value = "dwc:year") String year, @Parameter(name = "bdq:earliestDate") Integer lowerBound, @@ -2171,16 +2171,16 @@ public static DQResponse validationYearInrange( DQResponse result = new DQResponse(); // Specification - // INTERNAL_PREREQUISITES_NOT_MET if dwc:year is not present, - // or is EMPTY or cannot be interpreted as an integer; COMPLIANT - // if the value of dwc:year is within the Parameter range; - // otherwise NOT_COMPLIANT + // INTERNAL_PREREQUISITES_NOT_MET if dwc:year is not present, + // or is EMPTY or cannot be interpreted as an integer; COMPLIANT + // if the value of dwc:year is within the Parameter range; + // otherwise NOT_COMPLIANT // This test is defined as parameterized. - // bdq:earliestDate="1500"; bdq:latestDate=current year + // bdq:earliestDate="1582"; bdq:latestDate=current year if (lowerBound==null) { - lowerBound = 1500; + lowerBound = 1582; } if (upperBound==null) { upperBound = LocalDateTime.now().getYear(); diff --git a/src/main/java/org/filteredpush/qc/date/DwCEventDQDefaults.java b/src/main/java/org/filteredpush/qc/date/DwCEventDQDefaults.java index 2d4ffce..0cc018d 100644 --- a/src/main/java/org/filteredpush/qc/date/DwCEventDQDefaults.java +++ b/src/main/java/org/filteredpush/qc/date/DwCEventDQDefaults.java @@ -90,14 +90,14 @@ public static DQResponse validationEventdateInrange(@ActedUpon( * #84 Validation SingleRecord Conformance: year outofrange * * Provides: VALIDATION_YEAR_INRANGE - * Version: 2022-11-09 + * Version: 2023-06-17 * * @param year the provided dwc:year to evaluate * @return DQResponse the response of type ComplianceValue to return */ @Validation(label="VALIDATION_YEAR_INRANGE", description="Is the value of dwc:year within the Parameter range?") @Provides("ad0c8855-de69-4843-a80c-a5387d20fbc8") - @ProvidesVersion("https://rs.tdwg.org/bdq/terms/ad0c8855-de69-4843-a80c-a5387d20fbc8/2022-11-09") + @ProvidesVersion("https://rs.tdwg.org/bdq/terms/ad0c8855-de69-4843-a80c-a5387d20fbc8/2023-06-17") public static DQResponse validationYearInrange(@ActedUpon("dwc:year") String year) { DQResponse result = new DQResponse(); @@ -108,11 +108,11 @@ public static DQResponse validationYearInrange(@ActedUpon("dwc: // otherwise NOT_COMPLIANT // This test is defined as parameterized. - // bdq:earliestDate="1500"; bdq:latestDate=current year + // bdq:earliestDate="1582"; bdq:latestDate=current year Integer upperBound = LocalDateTime.now().getYear(); - return validationYearInrange(year, 1500, upperBound); + return validationYearInrange(year, 1582, upperBound); } } diff --git a/src/test/java/org/filteredpush/qc/date/DwCEventDQTestDefinitions.java b/src/test/java/org/filteredpush/qc/date/DwCEventDQTestDefinitions.java index 95257b8..eb5e3bf 100644 --- a/src/test/java/org/filteredpush/qc/date/DwCEventDQTestDefinitions.java +++ b/src/test/java/org/filteredpush/qc/date/DwCEventDQTestDefinitions.java @@ -500,7 +500,7 @@ public void testValidationEventInconsistent() { * Test method for {@link org.filteredpush.qc.date.DwCEventDQs#validationYearInrange(java.lang.String)}. */ @Test - public void testValidationYearOutofrange() { + public void testValidationYearInrange() { // Specification // INTERNAL_PREREQUISITES_NOT_MET if dwc:year is not present, @@ -509,7 +509,7 @@ public void testValidationYearOutofrange() { //otherwise NOT_COMPLIANT // This test is defined as parameterized. - // bdq:earliestDate="1600"; bdq:latestDate=current year + // bdq:earliestDate="1582"; bdq:latestDate=current year String year = ""; DQResponse result = DwCEventDQ.validationYearInrange(year, null, null); @@ -528,6 +528,7 @@ public void testValidationYearOutofrange() { logger.debug(result.getComment()); assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel()); assertEquals(ComplianceValue.COMPLIANT.getLabel(), result.getValue().getLabel()); + assertNotNull(result.getComment()); year = "1480"; result = DwCEventDQ.validationYearInrange(year, null, null); @@ -535,12 +536,30 @@ public void testValidationYearOutofrange() { assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel()); assertEquals(ComplianceValue.NOT_COMPLIANT.getLabel(), result.getValue().getLabel()); - year = "1580"; + year = "1583"; result = DwCEventDQ.validationYearInrange(year, null, null); logger.debug(result.getComment()); assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel()); assertEquals(ComplianceValue.COMPLIANT.getLabel(), result.getValue().getLabel()); + year = "1582"; + result = DwCEventDQ.validationYearInrange(year, null, null); + logger.debug(result.getComment()); + assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel()); + assertEquals(ComplianceValue.COMPLIANT.getLabel(), result.getValue().getLabel()); + + year = "1581"; + result = DwCEventDQ.validationYearInrange(year, null, null); + logger.debug(result.getComment()); + assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel()); + assertEquals(ComplianceValue.NOT_COMPLIANT.getLabel(), result.getValue().getLabel()); + + year = "1580"; + result = DwCEventDQ.validationYearInrange(year, null, null); + logger.debug(result.getComment()); + assertEquals(ResultState.RUN_HAS_RESULT.getLabel(), result.getResultState().getLabel()); + assertEquals(ComplianceValue.NOT_COMPLIANT.getLabel(), result.getValue().getLabel()); + year = "2000"; result = DwCEventDQ.validationYearInrange(year, 1900, 1999); logger.debug(result.getComment()); diff --git a/src/test/java/org/filteredpush/qc/date/DwcEventDQTest.java b/src/test/java/org/filteredpush/qc/date/DwcEventDQTest.java index 7da6866..166d242 100644 --- a/src/test/java/org/filteredpush/qc/date/DwcEventDQTest.java +++ b/src/test/java/org/filteredpush/qc/date/DwcEventDQTest.java @@ -1966,6 +1966,16 @@ public void testYearInRange() { assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState()); assertEquals(ComplianceValue.COMPLIANT, result.getValue()); + year = "1582"; + result = DwCEventDQ.validationYearInrange(year, null, null); + assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState()); + assertEquals(ComplianceValue.COMPLIANT, result.getValue()); + + year = "1581"; + result = DwCEventDQ.validationYearInrange(year, null, null); + assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState()); + assertEquals(ComplianceValue.NOT_COMPLIANT.getLabel(), result.getValue().getLabel()); + year = "1499"; result = DwCEventDQ.validationYearInrange(year, null, null); assertEquals(ResultState.RUN_HAS_RESULT, result.getResultState());