### Question:
R4FhirCarePlanToEnrollmentTransformer extends AbstractFhirCarePlanToEnrollmentTransformer { @Nonnull protected EnrollmentStatus convertStatus( @Nullable CarePlan.CarePlanStatus carePlanStatus ) { if ( carePlanStatus == null ) { throw new TransformerDataException( "Care plan status is mandatory." ); } switch ( carePlanStatus ) { case ACTIVE: return EnrollmentStatus.ACTIVE; case COMPLETED: return EnrollmentStatus.COMPLETED; case REVOKED: return EnrollmentStatus.CANCELLED; default: throw new TransformerDataException( "Care plan status is not allowed: " + carePlanStatus ); } } R4FhirCarePlanToEnrollmentTransformer( @Nonnull ScriptExecutor scriptExecutor, @Nonnull TrackedEntityMetadataService trackedEntityMetadataService, @Nonnull TrackedEntityService trackedEntityService,
        @Nonnull TrackedEntityRuleRepository trackedEntityRuleRepository, @Nonnull OrganizationUnitService organizationUnitService, @Nonnull ProgramMetadataService programMetadataService, @Nonnull EnrollmentService enrollmentService,
        @Nonnull FhirResourceMappingRepository resourceMappingRepository, @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository, @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull ValueConverter valueConverter ); @Nonnull @Override Set<FhirVersion> getFhirVersions();  }### Answer:
@Test public void convertStatusActive() { Assert.assertEquals( EnrollmentStatus.ACTIVE, transformer.convertStatus( CarePlan.CarePlanStatus.ACTIVE ) ); }
@Test public void convertStatusCompleted() { Assert.assertEquals( EnrollmentStatus.COMPLETED, transformer.convertStatus( CarePlan.CarePlanStatus.COMPLETED ) ); }
@Test public void convertStatusRevoked() { Assert.assertEquals( EnrollmentStatus.CANCELLED, transformer.convertStatus( CarePlan.CarePlanStatus.REVOKED ) ); }
@Test( expected = TransformerDataException.class ) public void convertStatusNull() { transformer.convertStatus( null ); }
@Test( expected = TransformerDataException.class ) public void convertStatusOther() { transformer.convertStatus( CarePlan.CarePlanStatus.DRAFT ); }