### Question:
R4DateTimeDhisToFhirTransformerUtils extends AbstractDateTimeDhisToFhirTransformerUtils { @Nullable @Override public IPrimitiveType<Date> getDayDateTimeElement( @Nullable Object dateTime ) { final LocalDateTime date = castDateTime( dateTime ); if ( date == null ) { return null; } return new DateTimeType( Date.from( date.atZone( zoneId ).toInstant() ), TemporalPrecisionEnum.DAY ); } R4DateTimeDhisToFhirTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nullable @Override IPrimitiveType<Date> getPreciseDateElement( @Nullable Object dateTime ); @Nullable @Override IPrimitiveType<Date> getDateTimeElement( @Nullable Object dateTime ); @Nullable @Override IPrimitiveType<Date> getDayDateTimeElement( @Nullable Object dateTime );  }### Answer:
@Test public void getDayDateTimeElementNull() { Assert.assertNull( utils.getDayDateTimeElement( null ) ); }
@Test public void getDayDateTimeElementDate() { final Date date = new Date(); Assert.assertEquals( new DateTimeType( date, TemporalPrecisionEnum.DAY ).getValueAsString(), Objects.requireNonNull( utils.getDayDateTimeElement( date ) ).getValueAsString() ); }
@Test public void getDayDateTimeElementLocalDateTime() { final Date date = new Date(); Assert.assertEquals( new DateTimeType( date, TemporalPrecisionEnum.DAY ).getValueAsString(), Objects.requireNonNull( utils.getDayDateTimeElement( LocalDateTime.ofInstant( date.toInstant(), ZoneId.systemDefault() ) ) ).getValueAsString() ); }
@Test public void getDayDateTimeElementElement() { final Date date = new Date(); Assert.assertEquals( new DateTimeType( date, TemporalPrecisionEnum.DAY ).getValueAsString(), Objects.requireNonNull( utils.getDayDateTimeElement( new DateTimeType( date ) ) ).getValueAsString() ); }