@VisibleForTesting
    Entity exportNativeEntity(RuleDao ruleDao, EntityDescriptorIds entityDescriptorIds) {
        final PipelineRuleEntity ruleEntity = PipelineRuleEntity.create(
                ValueReference.of(ruleDao.title()),
                ValueReference.of(ruleDao.description()),
                ValueReference.of(ruleDao.source()));
        final JsonNode data = objectMapper.convertValue(ruleEntity, JsonNode.class);
        return EntityV1.builder()
                .id(ModelId.of(entityDescriptorIds.getOrThrow(ruleDao.id(), ModelTypes.PIPELINE_RULE_V1)))
                .type(ModelTypes.PIPELINE_RULE_V1)
                .data(data)
                .build();
    }
@Test
    @MongoDBFixtures("PipelineRuleFacadeTest.json")
    public void exportNativeEntity() {
        final EntityDescriptor descriptor = EntityDescriptor.create("5adf25034b900a0fdb4e5338", ModelTypes.PIPELINE_RULE_V1);
        final EntityDescriptorIds entityDescriptorIds = EntityDescriptorIds.of(descriptor);
        final Entity entity = facade.exportEntity(descriptor, entityDescriptorIds).orElseThrow(AssertionError::new);

        assertThat(entity.id()).isEqualTo(ModelId.of(entityDescriptorIds.get(descriptor).orElse(null)));
        assertThat(entity.type()).isEqualTo(ModelTypes.PIPELINE_RULE_V1);

        final EntityV1 entityV1 = (EntityV1) entity;
        final PipelineEntity pipelineEntity = objectMapper.convertValue(entityV1.data(), PipelineEntity.class);
        assertThat(pipelineEntity.title()).isEqualTo(ValueReference.of("debug"));
        assertThat(pipelineEntity.description()).isEqualTo(ValueReference.of("Debug"));
        assertThat(pipelineEntity.source().asString(Collections.emptyMap())).startsWith("rule \"debug\"\n");
    }