@Test public void testGetReferenceDate() { OffsetDateTime actual = null; Object returned = null; ETLStatistics etlStatistics = new ETLStatistics(); NsrTaxonTransformer nsrTaxonTransformer = new NsrTaxonTransformer(etlStatistics); NsrTaxon nsrTaxon = nsrTaxa.get(0); Name name = nsrTaxon.getNames()[1]; returned = ReflectionUtil.call(nsrTaxonTransformer, "getReferenceDate", new Class[]{Name.class}, new Object[]{name}); actual = (OffsetDateTime) returned; String expectedDateString = "2020-01-01T00:00Z"; assertNotNull("01", actual); assertEquals("02", expectedDateString, actual.toString()); }
private OffsetDateTime getReferenceDate(Name name) { String date = val(name.getReference_date()); if (date == null) { return null; } if (date.toLowerCase().startsWith("in prep")) { if (logger.isDebugEnabled()) { logger.debug("Invalid input for <reference_date>: \"{}\"", date); } return null; } OffsetDateTime odt = new ESDateInput(date).parseAsYear(); if (odt == null && !suppressErrors) { warn("Invalid input for <reference_date>:", date); } return odt; }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private OffsetDateTime getReferenceDate(Name name) { String date = val(name.getReference_date()); if (date == null) { return null; } if (date.toLowerCase().startsWith("in prep")) { if (logger.isDebugEnabled()) { logger.debug("Invalid input for <reference_date>: \"{}\"", date); } return null; } OffsetDateTime odt = new ESDateInput(date).parseAsYear(); if (odt == null && !suppressErrors) { warn("Invalid input for <reference_date>:", date); } return odt; } }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private OffsetDateTime getReferenceDate(Name name) { String date = val(name.getReference_date()); if (date == null) { return null; } if (date.toLowerCase().startsWith("in prep")) { if (logger.isDebugEnabled()) { logger.debug("Invalid input for <reference_date>: \"{}\"", date); } return null; } OffsetDateTime odt = new ESDateInput(date).parseAsYear(); if (odt == null && !suppressErrors) { warn("Invalid input for <reference_date>:", date); } return odt; } NsrTaxonTransformer(ETLStatistics stats); }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private OffsetDateTime getReferenceDate(Name name) { String date = val(name.getReference_date()); if (date == null) { return null; } if (date.toLowerCase().startsWith("in prep")) { if (logger.isDebugEnabled()) { logger.debug("Invalid input for <reference_date>: \"{}\"", date); } return null; } OffsetDateTime odt = new ESDateInput(date).parseAsYear(); if (odt == null && !suppressErrors) { warn("Invalid input for <reference_date>:", date); } return odt; } NsrTaxonTransformer(ETLStatistics stats);  }
NsrTaxonTransformer extends AbstractJSONTransformer<Taxon> { private OffsetDateTime getReferenceDate(Name name) { String date = val(name.getReference_date()); if (date == null) { return null; } if (date.toLowerCase().startsWith("in prep")) { if (logger.isDebugEnabled()) { logger.debug("Invalid input for <reference_date>: \"{}\"", date); } return null; } OffsetDateTime odt = new ESDateInput(date).parseAsYear(); if (odt == null && !suppressErrors) { warn("Invalid input for <reference_date>:", date); } return odt; } NsrTaxonTransformer(ETLStatistics stats);   }