### Question:
R4ObservationFhirToDhisTransformerUtils extends AbstractObservationFhirToDhisTransformerUtils { @Nullable @Override public String getComponentText( @Nullable IBaseResource resource ) { final Observation observation = (Observation) resource; if ( (observation == null) || !observation.hasComponent() ) { return null; } final StringBuilder text = new StringBuilder(); for ( final ObservationComponentComponent component : observation.getComponent() ) { if ( component.hasValueStringType() ) { if ( text.length() > 0 ) { text.append( COMPONENT_SEPARATOR ); } text.append( component.getValue().toString() ); } } return (text.length() == 0) ? null : text.toString(); } R4ObservationFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext, @Nonnull R4FhirClientFhirToDhisTransformerUtils clientTransformUtils,
        @Nonnull R4CodeFhirToDhisTransformerUtils codeTransformerUtils ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Nonnull @Override String getResourceName(); @Nullable @Override ICompositeType getCodes( @Nullable IBaseResource resource ); @Nullable @Override String getComponentText( @Nullable IBaseResource resource ); @Override @Nullable IBaseBackboneElement getBackboneElement( @Nullable List<? extends IBaseBackboneElement> backboneElements, @Nonnull String system, @Nonnull String code );  }### Answer:
@Test public void getComponentTextNull() { final Observation observation = new Observation(); Assert.assertNull( utils.getComponentText( observation ) ); }
@Test public void getComponentText() { final Observation observation = new Observation(); observation.addComponent().setValue( new StringType( "This is a text." ) ); observation.addComponent().setValue( new StringType( "This is another text." ) ); Assert.assertEquals( "This is a text.\nThis is another text.", utils.getComponentText( observation ) ); }