### Question:
R4DateTimeFhirToDhisTransformerUtils extends AbstractDateTimeFhirToDhisTransformerUtils { @Override public boolean isValidNow( @Nullable ICompositeType period ) { if ( period == null ) { return true; } final Period p = (Period) period; final Date now = new Date(); return (p.getEnd() == null) || !now.after( p.getEnd() ); } R4DateTimeFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Override boolean hasDayPrecision( @Nullable IPrimitiveType<Date> dateTime ); @Override boolean isValidNow( @Nullable ICompositeType period );  }### Answer:
@Test public void isValidNowNull() { Assert.assertTrue( utils.isValidNow( null ) ); }
@Test public void isValidNowStart() { Assert.assertTrue( utils.isValidNow( new Period().setStart( Date.from( ZonedDateTime.now().plusDays( 2 ).toInstant() ) ) ) ); }
@Test public void isValidNowEndFuture() { Assert.assertTrue( utils.isValidNow( new Period().setEnd( Date.from( ZonedDateTime.now().plusDays( 2 ).toInstant() ) ) ) ); }
@Test public void isValidNowEndPast() { Assert.assertFalse( utils.isValidNow( new Period().setEnd( Date.from( ZonedDateTime.now().minusDays( 2 ).toInstant() ) ) ) ); }