Source:
public void testPerformDefaultTransformationExtendedData() throws CatalogTransformerException, DateTimeParseException { MetacardImpl metacard = createMockMetacard(); metacard.setLocation(POINT_WKT); metacard.setCreatedDate(METACARD_DATE); metacard.setEffectiveDate(METACARD_DATE); metacard.setExpirationDate(METACARD_DATE); metacard.setModifiedDate(METACARD_DATE); metacard.setTags(METACARD_TAGS); final Set<AttributeDescriptor> attributeDescriptors = metacard.getMetacardType().getAttributeDescriptors(); Placemark placemark = kmlTransformer.performDefaultTransformation(metacard); final List<Data> dataList = placemark.getExtendedData().getData(); int dataCount = 0; for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { final String attributeName = attributeDescriptor.getName(); final Attribute attribute = metacard.getAttribute(attributeName); if (attribute != null) { dataCount++; } } assertThat(dataList.size(), is(dataCount)); for (Data data : dataList) { switch (data.getName()) { case "id": assertThat(data.getValue(), is(METACARD_ID)); break; case "title": assertThat(data.getValue(), is(METACARD_TITLE)); break; case "location": assertThat(data.getValue(), is(POINT_WKT)); break; case "metadata-content-type": assertThat(data.getValue(), is(METACARD_TYPE)); break; case "metadata-content-type-version": assertThat(data.getValue(), is(METACARD_VERSION)); break; case "metadata": assertThat(data.getValue(), is(METACARD_METADATA)); break; case "metacard-tags": assertThat( data.getValue(), is(METACARD_TAGS.asList().get(0) + ", " + METACARD_TAGS.asList().get(1))); break; case "modified": case "effective": case "expiration": case "created": assertThat(data.getValue(), is(METACARD_DATE_STRING)); break; } } }

Target:
public void testPerformDefaultTransformationExtendedData() throws CatalogTransformerException, DateTimeParseException { MetacardImpl metacard = createMockMetacard(); metacard.setLocation(POINT_WKT); metacard.setCreatedDate(metacardDate); metacard.setEffectiveDate(metacardDate); metacard.setExpirationDate(metacardDate); metacard.setModifiedDate(metacardDate); metacard.setTags(METACARD_TAGS); final Set<AttributeDescriptor> attributeDescriptors = metacard.getMetacardType().getAttributeDescriptors(); Placemark placemark = kmlTransformer.performDefaultTransformation(metacard); final List<Data> dataList = placemark.getExtendedData().getData(); int dataCount = 0; for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { final String attributeName = attributeDescriptor.getName(); final Attribute attribute = metacard.getAttribute(attributeName); if (attribute != null) { dataCount++; } } assertThat(dataList.size(), is(dataCount)); for (Data data : dataList) { switch (data.getName()) { case Core.ID: assertThat(data.getValue(), is(METACARD_ID)); break; case Core.TITLE: assertThat(data.getValue(), is(METACARD_TITLE)); break; case Core.LOCATION: assertThat(data.getValue(), is(POINT_WKT)); break; case Metacard.CONTENT_TYPE: assertThat(data.getValue(), is(METACARD_TYPE)); break; case Metacard.CONTENT_TYPE_VERSION: assertThat(data.getValue(), is(METACARD_VERSION)); break; case Core.METADATA: assertThat(data.getValue(), is(METACARD_METADATA)); break; case Core.METACARD_TAGS: assertThat( data.getValue(), is(METACARD_TAGS.asList().get(0) + "," + METACARD_TAGS.asList().get(1))); break; case Core.MODIFIED: case Metacard.EFFECTIVE: case Core.EXPIRATION: case Core.CREATED: assertThat(data.getValue(), is(METACARD_DATE_STRING)); break; default: throw new IllegalArgumentException( String.format("Data %s was not expected", data.getName())); } } }