### Question:
FhirRepositoryImpl implements FhirRepository { @Nonnull protected String createDhisFhirResourceId( @Nonnull FhirToDhisTransformOutcome<? extends DhisResource> outcome, @Nonnull DhisResource persistedDhisResource ) { if ( outcome.getRule().isSimpleFhirId() ) { return DhisFhirResourceId.toString( null, persistedDhisResource.getId(), null ); } else { return DhisFhirResourceId.toString( persistedDhisResource.getResourceType(), persistedDhisResource.getId(), outcome.getRule().getId() ); } } FhirRepositoryImpl( @Nonnull AuthorizationContext authorizationContext,
        @Nonnull LockManager lockManager, @Nonnull RequestCacheService requestCacheService,
        @Nonnull FhirClientSystemRepository fhirClientSystemRepository,
        @Nonnull FhirClientResourceRepository fhirClientResourceRepository,
        @Nonnull SubscriptionFhirResourceRepository subscriptionFhirResourceRepository,
        @Nonnull StoredFhirResourceService storedItemService,
        @Nonnull FhirResourceRepository fhirResourceRepository,
        @Nonnull FhirToDhisTransformerService fhirToDhisTransformerService,
        @Nonnull DhisResourceRepository dhisResourceRepository,
        @Nonnull FhirDhisAssignmentRepository fhirDhisAssignmentRepository ); @Override @Nullable @HystrixCommand( ignoreExceptions = { DhisConflictException.class, TransformerDataException.class, TransformerMappingException.class, TrackedEntityInstanceNotFoundException.class, DhisDataExistsException.class, UnauthorizedException.class } ) @Transactional( propagation = Propagation.NOT_SUPPORTED ) FhirRepositoryOperationOutcome save( @Nonnull FhirClientResource fhirClientResource, @Nonnull IBaseResource resource, @Nullable FhirRepositoryOperation fhirRepositoryOperation ); @Override @HystrixCommand( ignoreExceptions = { DhisConflictException.class, TransformerDataException.class, TransformerMappingException.class, TrackedEntityInstanceNotFoundException.class, DhisDataExistsException.class, UnauthorizedException.class } ) @Transactional( propagation = Propagation.NOT_SUPPORTED ) boolean delete( @Nonnull FhirClientResource fhirClientResource, @Nonnull DhisFhirResourceId dhisFhirResourceId ); static final int MAX_CONFLICT_RETRIES; }### Answer:
@Test public void createDhisFhirResourceIdNonSimple() { final TrackedEntityRule rule = new TrackedEntityRule(); rule.setId( UUID.fromString( "1f989050-500c-4eaa-b6dd-0bef9fef7023" ) ); final TrackedEntityInstance trackedEntityInstance = new TrackedEntityInstance(); trackedEntityInstance.setId( "b1234567890" ); final FhirToDhisTransformOutcome<TrackedEntityInstance> outcome = new FhirToDhisTransformOutcome<>( rule, trackedEntityInstance, true ); Assert.assertEquals( "te-b1234567890-1f989050500c4eaab6dd0bef9fef7023", repository.createDhisFhirResourceId( outcome, trackedEntityInstance ) ); }
@Test public void createDhisFhirResourceIdSimple() { final TrackedEntityRule rule = new TrackedEntityRule(); rule.setId( UUID.fromString( "1f989050-500c-4eaa-b6dd-0bef9fef7023" ) ); rule.setSimpleFhirId( true ); final TrackedEntityInstance trackedEntityInstance = new TrackedEntityInstance(); trackedEntityInstance.setId( "b1234567890" ); final FhirToDhisTransformOutcome<TrackedEntityInstance> outcome = new FhirToDhisTransformOutcome<>( rule, trackedEntityInstance, true ); Assert.assertEquals( "b1234567890", repository.createDhisFhirResourceId( outcome, trackedEntityInstance ) ); }