@SuppressWarnings("deprecation")
    public static FlowWithSource of(Flow flow, String source) {
        return FlowWithSource.builder()
            .tenantId(flow.tenantId)
            .id(flow.id)
            .namespace(flow.namespace)
            .revision(flow.revision)
            .description(flow.description)
            .labels(flow.labels)
            .inputs(flow.inputs)
            .outputs(flow.outputs)
            .variables(flow.variables)
            .tasks(flow.tasks)
            .errors(flow.errors)
            .listeners(flow.listeners)
            .triggers(flow.triggers)
            .pluginDefaults(flow.pluginDefaults)
            .disabled(flow.disabled)
            .deleted(flow.deleted)
            .source(source)
            .concurrency(flow.concurrency)
            .build();
    }
@SuppressWarnings("deprecation")
    @Test
    void of() {
        // test that all fields are transmitted to FlowWithSource
        Flow flow = Flow.builder()
            .tenantId("tenantId")
            .id(IdUtils.create())
            .namespace("io.kestra.unittest")
            .description("description")
            .labels(List.of(
                new Label("key", "value")
            ))
            .inputs(List.of(
                StringInput.builder().id("strInput").build()
            ))
            .variables(Map.of(
                "varKey", "varValue"
            ))
            .tasks(List.of(
                Log.builder()
                    .id(IdUtils.create())
                    .type(Log.class.getName())
                    .message("Hello World")
                    .build()
            ))
            .errors(List.of(
                Log.builder()
                    .id(IdUtils.create())
                    .type(Log.class.getName())
                    .message("Error")
                    .build()
            ))
            .listeners(List.of(
                Listener.builder()
                    .conditions(List.of(ExpressionCondition.builder().expression("true").build()))
                    .build()
            ))
            .triggers(List.of(
                Schedule.builder().id("schedule").cron("0 1 9 * * *").build()
            ))
            .pluginDefaults(List.of(
                PluginDefault.builder()
                    .type(Log.class.getName())
                    .forced(true)
                    .values(Map.of(
                        "message", "Default message"
                    ))
                    .build()
            ))
            .concurrency(
                Concurrency.builder()
                    .behavior(Concurrency.Behavior.CANCEL)
                    .limit(2)
                    .build()
            )
            .build();
        String expectedSource = flow.generateSource() + " # additional comment";
        FlowWithSource of = FlowWithSource.of(flow, expectedSource);

        assertThat(of.equalsWithoutRevision(flow), is(true));
        assertThat(of.getSource(), is(expectedSource));
    }