### Question:
PipelineMapper implements EntityMapper<PipelineDoc> { @Override public XContentBuilder map(final EntityContainer<PipelineDoc> container) { PipelineDoc pipelineDoc = container.getEntity(); try (XContentBuilder jsonBuilder = XContentFactory.jsonBuilder()) { List<String> revisions = pipelineDoc.getRevisions() .stream() .map(Revision::getName) .collect(Collectors.toList()); jsonBuilder .startObject() .field("id", pipelineDoc.getPipeline().getId()) .field(DOC_TYPE_FIELD, SearchDocumentType.PIPELINE.name()) .field("name", pipelineDoc.getPipeline().getName()) .field("description", pipelineDoc.getPipeline().getDescription()) .field("createdDate", parseDataToString(pipelineDoc.getPipeline().getCreatedDate())) .field("parentId", pipelineDoc.getPipeline().getParentFolderId()) .field("repository", pipelineDoc.getPipeline().getRepository()) .field("versions", revisions) .field("templateId", pipelineDoc.getPipeline().getTemplateId()); buildUserContent(container.getOwner(), jsonBuilder); buildMetadata(container.getMetadata(), jsonBuilder); buildPermissions(container.getPermissions(), jsonBuilder); jsonBuilder.endObject(); return jsonBuilder; } catch (IOException e) { throw new IllegalArgumentException("Failed to create elasticsearch document for pipeline: ", e); } }  @Override XContentBuilder map(final EntityContainer<PipelineDoc> container);  }### Answer:
@Test void shouldMapPipeline() throws IOException { PipelineMapper mapper = new PipelineMapper(); Pipeline pipeline = new Pipeline(); pipeline.setId(1L); pipeline.setName(TEST_NAME); pipeline.setCreatedDate(DateUtils.now()); pipeline.setParentFolderId(2L); pipeline.setDescription(TEST_DESCRIPTION); pipeline.setRepository(TEST_REPO); pipeline.setTemplateId(TEST_TEMPLATE); Revision revision = new Revision(); revision.setName(TEST_NAME); PipelineDoc pipelineDoc = PipelineDoc.builder() .pipeline(pipeline) .revisions(Collections.singletonList(revision)).build(); EntityContainer<PipelineDoc> container = EntityContainer.<PipelineDoc>builder() .entity(pipelineDoc) .owner(USER) .metadata(METADATA) .permissions(PERMISSIONS_CONTAINER) .build(); XContentBuilder contentBuilder = mapper.map(container); verifyPipeline(pipeline, contentBuilder); verifyPipelineUser(USER, contentBuilder); verifyPermissions(PERMISSIONS_CONTAINER, contentBuilder); verifyMetadata(EXPECTED_METADATA, contentBuilder); }