@Override
    public NativeEntity<PipelineDao> createNativeEntity(Entity entity,
                                                        Map<String, ValueReference> parameters,
                                                        Map<EntityDescriptor, Object> nativeEntities,
                                                        String username) {
        if (entity instanceof EntityV1) {
            return decode((EntityV1) entity, parameters, nativeEntities);
        } else {
            throw new IllegalArgumentException("Unsupported entity version: " + entity.getClass());
        }
    }
@Test
    public void createNativeEntityWithDefaultStream() throws NotFoundException {
        final Entity entity = EntityV1.builder()
                .id(ModelId.of("1"))
                .type(ModelTypes.PIPELINE_V1)
                .data(objectMapper.convertValue(PipelineEntity.create(
                        ValueReference.of("Title"),
                        ValueReference.of("Description"),
                        ValueReference.of("pipeline \"Title\"\nstage 0 match either\nrule \"debug\"\nrule \"no-op\"\nend"),
                        Collections.singleton(ValueReference.of(Stream.DEFAULT_STREAM_ID))), JsonNode.class))
                .build();

        final FakeStream fakeDefaultStream = new FakeStream("All message Fake") {
            @Override
            protected ObjectId getObjectId() {
                return new ObjectId(Stream.DEFAULT_STREAM_ID);
            }
        };
        when(streamService.load(Stream.DEFAULT_STREAM_ID)).thenReturn(fakeDefaultStream);

        final Map<EntityDescriptor, Object> nativeEntities = Collections.emptyMap();
        final NativeEntity<PipelineDao> nativeEntity = facade.createNativeEntity(entity, Collections.emptyMap(), nativeEntities, "username");

        assertThat(connectionsService.load(fakeDefaultStream.getId()).pipelineIds())
                .containsOnly(nativeEntity.entity().id());
    }