### Question:
DockerRegistryMapper implements EntityMapper<DockerRegistry> { @Override public XContentBuilder map(final EntityContainer<DockerRegistry> container) { DockerRegistry dockerRegistry = container.getEntity(); try (XContentBuilder jsonBuilder = XContentFactory.jsonBuilder()) { jsonBuilder .startObject() .field(DOC_TYPE_FIELD, SearchDocumentType.DOCKER_REGISTRY.name()) .field("id", dockerRegistry.getId()) .field("name", dockerRegistry.getName()) .field("path", dockerRegistry.getPath()) .field("createdDate", parseDataToString(dockerRegistry.getCreatedDate())) .field("description", dockerRegistry.getDescription()) .field("userName", dockerRegistry.getUserName()); 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 docker registry: ", e); } }  @Override XContentBuilder map(final EntityContainer<DockerRegistry> container);  }### Answer:
@Test void shouldMapDockerRegistry() throws IOException { DockerRegistryMapper mapper = new DockerRegistryMapper(); DockerRegistry registry = new DockerRegistry(); registry.setId(1L); registry.setDescription(TEST_DESCRIPTION); registry.setName(TEST_NAME); registry.setPath(TEST_PATH); registry.setUserName(USER_NAME); EntityContainer<DockerRegistry> container = EntityContainer.<DockerRegistry>builder() .entity(registry) .owner(USER) .metadata(METADATA) .permissions(PERMISSIONS_CONTAINER) .build(); XContentBuilder contentBuilder = mapper.map(container); verifyDockerRegistry(registry, contentBuilder); verifyPipelineUser(USER, contentBuilder); verifyPermissions(PERMISSIONS_CONTAINER, contentBuilder); verifyMetadata(EXPECTED_METADATA, contentBuilder); }