### Question:
RunBillingMapper extends AbstractEntityMapper<PipelineRunBillingInfo> { @Override public XContentBuilder map(final EntityContainer<PipelineRunBillingInfo> container) { try (XContentBuilder jsonBuilder = XContentFactory.jsonBuilder()) { final PipelineRunBillingInfo billingInfo = container.getEntity(); final PipelineRun run = billingInfo.getEntity().getPipelineRun(); jsonBuilder .startObject() .field(DOC_TYPE_FIELD, SearchDocumentType.PIPELINE_RUN.name()) .field("run_id", run.getId()) .field("resource_type", billingInfo.getResourceType()) .field("pipeline", run.getPipelineId()) .field("tool", run.getDockerImage()) .field("instance_type", run.getInstance().getNodeType()) .field("compute_type", billingInfo.getEntity().getRunType()) .field("cost", billingInfo.getCost()) .field("usage_minutes", billingInfo.getUsageMinutes()) .field("paused_minutes", billingInfo.getPausedMinutes()) .field("run_price", run.getPricePerHour().unscaledValue().longValue()) .field("compute_price", scaled(run.getComputePricePerHour())) .field("disk_price", scaled(run.getDiskPricePerHour())) .field("cloudRegionId", run.getInstance().getCloudRegionId()) .field("created_date", billingInfo.getDate()); buildUserContent(container.getOwner(), jsonBuilder); jsonBuilder.endObject(); return jsonBuilder; } catch (IOException e) { throw new IllegalArgumentException("Failed to create elasticsearch document for pipeline run: ", e); } } RunBillingMapper(@Value("${sync.billing.center.key}") final String billingCenterKey); @Override XContentBuilder map(final EntityContainer<PipelineRunBillingInfo> container);  }### Answer:
@Test public void testRunMapperMap() throws IOException { final PipelineRun run = TestUtils.createTestPipelineRun(TEST_RUN_ID, TEST_PIPELINE_ID, TEST_TOOL_IMAGE, TEST_PRICE, TestUtils.createTestInstance(TEST_REGION_ID, TEST_NODE_TYPE)); final PipelineRunBillingInfo billing = PipelineRunBillingInfo.builder() .run(new PipelineRunWithType(run, Collections.emptyList(), ComputeType.CPU)) .date(TEST_DATE) .cost(TEST_COST) .usageMinutes(TEST_USAGE_MINUTES) .build(); final EntityContainer<PipelineRunBillingInfo> billingContainer = EntityContainer.<PipelineRunBillingInfo>builder() .entity(billing) .owner(testUserWithMetadata) .build(); final XContentBuilder mappedBilling = mapper.map(billingContainer); final Map<String, Object> mappedFields = TestUtils.getPuttedObject(mappedBilling); Assert.assertEquals(TEST_RUN_ID.intValue(), mappedFields.get("run_id")); Assert.assertEquals(ResourceType.COMPUTE.toString(), mappedFields.get("resource_type")); Assert.assertEquals(TEST_PIPELINE_ID.intValue(), mappedFields.get("pipeline")); Assert.assertEquals(TEST_TOOL_IMAGE, mappedFields.get("tool")); Assert.assertEquals(TEST_NODE_TYPE, mappedFields.get("instance_type")); Assert.assertEquals(TEST_COST.intValue(), mappedFields.get("cost")); Assert.assertEquals(TEST_USAGE_MINUTES.intValue(), mappedFields.get("usage_minutes")); Assert.assertEquals(run.getPricePerHour().intValue(), mappedFields.get("run_price")); Assert.assertEquals(TEST_REGION_ID.intValue(), mappedFields.get("cloudRegionId")); Assert.assertEquals(TEST_USER_NAME, mappedFields.get("owner")); TestUtils.verifyStringArray(TEST_GROUPS, mappedFields.get("groups")); }