### Question:
R4GeoFhirToDhisTransformerUtils extends AbstractGeoFhirToDhisTransformerUtils { @Override @Nullable public Location getLocation( @Nonnull IElement element ) throws TransformerException { final Element e = (Element) element; final List<Extension> locationExtensions = e.getExtensionsByUrl( GEO_LOCATION_URI ); if ( locationExtensions.isEmpty() ) { return null; } if ( locationExtensions.size() > 1 ) { throw new TransformerMappingException( "Element " + e.fhirType() + " contains " + locationExtensions.size() + " GEO locations." ); } final Extension locationExtension = locationExtensions.get( 0 ); return new Location( getLocationComponentValue( e, locationExtension, LONGITUDE_URL ), getLocationComponentValue( e, locationExtension, LATITUDE_URL ) ); } R4GeoFhirToDhisTransformerUtils( @Nonnull ScriptExecutionContext scriptExecutionContext ); @Nonnull @Override Set<FhirVersion> getFhirVersions(); @Override @Nullable Location getLocation( @Nonnull IElement element );  }### Answer:
@Test public void getLocation() { final Address address = new Address(); address.addExtension() .setUrl( "http: .addExtension( new Extension() .setUrl( "latitude" ) .setValue( new DecimalType( 8.4665341 ) ) ) .addExtension( new Extension() .setUrl( "longitude" ) .setValue( new DecimalType( -13.262743 ) ) ); final Location location = utils.getLocation( address ); Assert.assertNotNull( location ); Assert.assertEquals( 8.4665341, location.getLatitude(), 0 ); Assert.assertEquals( -13.262743, location.getLongitude(), 0 ); }
@Test public void getNoLocation() { final Address address = new Address(); final Location location = utils.getLocation( address ); Assert.assertNull( location ); }