@Override
    public NativeEntity<Output> createNativeEntity(Entity entity,
                                                   Map<String, ValueReference> parameters,
                                                   Map<EntityDescriptor, Object> nativeEntities,
                                                   String username) {
        if (entity instanceof EntityV1) {
            return decode((EntityV1) entity, parameters, username);
        } else {
            throw new IllegalArgumentException("Unsupported entity version: " + entity.getClass());

        }
    }
@Test
    public void createNativeEntity() {
        final Entity entity = EntityV1.builder()
                .id(ModelId.of("1"))
                .type(ModelTypes.OUTPUT_V1)
                .data(objectMapper.convertValue(OutputEntity.create(
                        ValueReference.of("STDOUT"),
                        ValueReference.of("org.graylog2.outputs.LoggingOutput"),
                        ReferenceMapUtils.toReferenceMap(ImmutableMap.of("prefix", "Writing message: "))
                ), JsonNode.class))
                .build();

        final NativeEntity<Output> nativeEntity = facade.createNativeEntity(entity, Collections.emptyMap(), Collections.emptyMap(), "username");

        assertThat(nativeEntity.descriptor().type()).isEqualTo(ModelTypes.OUTPUT_V1);
        assertThat(nativeEntity.entity().getTitle()).isEqualTo("STDOUT");
        assertThat(nativeEntity.entity().getType()).isEqualTo("org.graylog2.outputs.LoggingOutput");
        assertThat(nativeEntity.entity().getCreatorUserId()).isEqualTo("username");
        assertThat(nativeEntity.entity().getConfiguration()).containsEntry("prefix", "Writing message: ");
    }