public Integer doCall() throws Exception {
        // Operator id must be set
        if (ObjectHelper.isEmpty(operatorId)) {
            printer().println("Operator id must be set");
            return -1;
        }

        List<String> integrationSources
                = Stream.concat(Arrays.stream(Optional.ofNullable(filePaths).orElseGet(() -> new String[] {})),
                        Arrays.stream(Optional.ofNullable(sources).orElseGet(() -> new String[] {}))).toList();

        Integration integration = new Integration();
        integration.setSpec(new IntegrationSpec());
        integration.getMetadata()
                .setName(getIntegrationName(integrationSources));

        if (dependencies != null && dependencies.length > 0) {
            List<String> deps = new ArrayList<>();
            for (String dependency : dependencies) {
                String normalized = normalizeDependency(dependency);
                validateDependency(normalized, printer());
                deps.add(normalized);
            }

            integration.getSpec().setDependencies(deps);
        }

        if (kit != null) {
            IntegrationKit integrationKit = new IntegrationKit();
            integrationKit.setName(kit);
            integration.getSpec().setIntegrationKit(integrationKit);
        }

        if (traitProfile != null) {
            TraitProfile p = TraitProfile.valueOf(traitProfile.toUpperCase(Locale.US));
            integration.getSpec().setProfile(p.name().toLowerCase(Locale.US));
        }

        if (repositories != null && repositories.length > 0) {
            integration.getSpec().setRepositories(List.of(repositories));
        }

        if (annotations != null && annotations.length > 0) {
            integration.getMetadata().setAnnotations(Arrays.stream(annotations)
                    .filter(it -> it.contains("="))
                    .map(it -> it.split("="))
                    .filter(it -> it.length == 2)
                    .collect(Collectors.toMap(it -> it[0].trim(), it -> it[1].trim())));
        }

        if (integration.getMetadata().getAnnotations() == null) {
            integration.getMetadata().setAnnotations(new HashMap<>());
        }

        // --operator-id={id} is a syntax sugar for '--annotation camel.apache.org/operator.id={id}'
        integration.getMetadata().getAnnotations().put(CamelKCommand.OPERATOR_ID_LABEL, operatorId);

        // --integration-profile={id} is a syntax sugar for '--annotation camel.apache.org/integration-profile.id={id}'
        if (integrationProfile != null) {
            if (integrationProfile.contains("/")) {
                String[] namespacedName = integrationProfile.split("/", 2);
                integration.getMetadata().getAnnotations().put(CamelKCommand.INTEGRATION_PROFILE_NAMESPACE_ANNOTATION,
                        namespacedName[0]);
                integration.getMetadata().getAnnotations().put(CamelKCommand.INTEGRATION_PROFILE_ANNOTATION, namespacedName[1]);
            } else {
                integration.getMetadata().getAnnotations().put(CamelKCommand.INTEGRATION_PROFILE_ANNOTATION,
                        integrationProfile);
            }
        }

        if (labels != null && labels.length > 0) {
            integration.getMetadata().setLabels(Arrays.stream(labels)
                    .filter(it -> it.contains("="))
                    .map(it -> it.split("="))
                    .filter(it -> it.length == 2)
                    .collect(Collectors.toMap(it -> it[0].trim(), it -> it[1].trim())));
        }

        Traits traitsSpec = TraitHelper.parseTraits(traits);

        if (image != null) {
            TraitHelper.configureContainerImage(traitsSpec, image, null, null, null, null);
        } else {
            List<Source> resolvedSources = SourceHelper.resolveSources(integrationSources, compression);

            List<Flows> flows = new ArrayList<>();
            List<Sources> sources = new ArrayList<>();
            for (Source source : resolvedSources) {
                if (useFlows && source.isYaml() && !source.compressed()) {
                    JsonNode json = KubernetesHelper.json().convertValue(
                            KubernetesHelper.yaml().load(source.content()), JsonNode.class);
                    if (json.isArray()) {
                        for (JsonNode item : json) {
                            Flows flowSpec = new Flows();
                            flowSpec.setAdditionalProperties(KubernetesHelper.json().readerFor(Map.class).readValue(item));
                            flows.add(flowSpec);
                        }
                    } else {
                        Flows flowSpec = new Flows();
                        flowSpec.setAdditionalProperties(KubernetesHelper.json().readerFor(Map.class).readValue(json));
                        flows.add(flowSpec);
                    }
                } else {
                    Sources sourceSpec = new Sources();
                    sourceSpec.setName(source.name());
                    sourceSpec.setLanguage(source.language());
                    sourceSpec.setContent(source.content());
                    sourceSpec.setCompression(source.compressed());
                    sources.add(sourceSpec);
                }
            }

            if (!flows.isEmpty()) {
                integration.getSpec().setFlows(flows);
            }

            if (!sources.isEmpty()) {
                integration.getSpec().setSources(sources);
            }
        }

        if (podTemplate != null) {
            Source templateSource = SourceHelper.resolveSource(podTemplate);
            if (!templateSource.isYaml()) {
                throw new RuntimeCamelException(
                        ("Unsupported pod template %s - " +
                         "please use proper YAML source").formatted(templateSource.extension()));
            }

            Spec podSpec = KubernetesHelper.yaml().loadAs(templateSource.content(), Spec.class);
            Template template = new Template();
            template.setSpec(podSpec);
            integration.getSpec().setTemplate(template);
        }

        convertOptionsToTraits(traitsSpec);
        integration.getSpec().setTraits(traitsSpec);

        if (serviceAccount != null) {
            integration.getSpec().setServiceAccountName(serviceAccount);
        }

        if (output != null) {
            switch (output) {
                case "k8s" -> {
                    List<Source> sources = SourceHelper.resolveSources(integrationSources);
                    TraitContext context
                            = new TraitContext(integration.getMetadata().getName(), "1.0-SNAPSHOT", printer(), sources);
                    TraitHelper.configureContainerImage(traitsSpec, image, "quay.io", null, integration.getMetadata().getName(),
                            "1.0-SNAPSHOT");

                    new TraitCatalog().apply(traitsSpec, context, traitProfile);

                    printer().println(
                            context.buildItems().stream().map(KubernetesHelper::dumpYaml).collect(Collectors.joining("---")));
                }
                case "yaml" -> printer().println(KubernetesHelper.dumpYaml(integration));
                case "json" -> printer().println(
                        JSonHelper.prettyPrint(KubernetesHelper.json().writer().writeValueAsString(integration), 2));
                default -> {
                    printer().printf("Unsupported output format '%s' (supported: yaml, json)%n", output);
                    return -1;
                }
            }

            return 0;
        }

        final AtomicBoolean updated = new AtomicBoolean(false);
        client(Integration.class).resource(integration).createOr(it -> {
            updated.set(true);
            return it.update();
        });

        if (updated.get()) {
            printer().printf("Integration %s updated%n", integration.getMetadata().getName());
        } else {
            printer().printf("Integration %s created%n", integration.getMetadata().getName());
        }

        if (wait || logs) {
            client(Integration.class).withName(integration.getMetadata().getName())
                    .waitUntilCondition(it -> "Running".equals(it.getStatus().getPhase()), 10, TimeUnit.MINUTES);
        }

        if (logs) {
            IntegrationLogs logsCommand = new IntegrationLogs(getMain());
            logsCommand.withClient(client());
            logsCommand.withName(integration.getMetadata().getName());
            logsCommand.doCall();
        }

        return 0;
    }
@Test
    public void shouldAddTraits() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.traits = new String[] { "logging.level=DEBUG", "container.image-pull-policy=Always" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    container:
                      imagePullPolicy: Always
                    logging:
                      level: DEBUG""", printer.getOutput());
    }

    @Test
    public void shouldAddTraitAddons() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.traits = new String[] {
                "container.port=8080", "telemetry.enabled=true",
                "telemetry.endpoint=http://opentelemetrycollector.ns.svc.cluster.local:8080" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    addons:
                      telemetry:
                        endpoint: http://opentelemetrycollector.ns.svc.cluster.local:8080
                        enabled: true
                    container:
                      port: 8080""", printer.getOutput());
    }

    @Test
    public void shouldSpecFromOptions() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.name = "custom";
        command.operatorId = "custom-operator";
        command.serviceAccount = "service-account-name";
        command.labels = new String[] { "custom-label=enabled" };
        command.annotations = new String[] { "custom-annotation=enabled" };
        command.repositories = new String[] { "http://custom-repository" };
        command.traitProfile = "knative";
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    custom-annotation: enabled
                    camel.apache.org/operator.id: custom-operator
                  labels:
                    custom-label: enabled
                  name: custom
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  profile: knative
                  repositories:
                  - http://custom-repository
                  serviceAccountName: service-account-name
                  traits: {}""", printer.getOutput());
    }

    @Test
    public void shouldAddVolumes() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.volumes = new String[] { "/foo", "/bar" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    mount:
                      volumes:
                      - /foo
                      - /bar""", printer.getOutput());
    }

    @Test
    public void shouldAddDependencies() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.dependencies = new String[] { "camel-jackson", "camel-quarkus-jms", "mvn:foo:bar:1.0" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  dependencies:
                  - camel:jackson
                  - camel:jms
                  - mvn:foo:bar:1.0
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits: {}""", printer.getOutput());
    }

    @Test
    public void shouldAddEnvVars() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.envVars = new String[] { "CAMEL_FOO=bar" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    environment:
                      vars:
                      - CAMEL_FOO=bar""", printer.getOutput());
    }

    @Test
    public void shouldAddProperties() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.properties = new String[] { "camel.foo=bar" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    camel:
                      properties:
                      - camel.foo=bar""", printer.getOutput());
    }

    @Test
    public void shouldAddBuildProperties() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.buildProperties = new String[] { "camel.foo=bar" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    builder:
                      properties:
                      - camel.foo=bar""", printer.getOutput());
    }

    @Test
    public void shouldUseKit() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.kit = "kit-123456789";
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  integrationKit:
                    name: kit-123456789
                  traits: {}""", printer.getOutput());
    }

    @Test
    public void shouldUseIntegrationProfile() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.integrationProfile = "my-profile";
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                    camel.apache.org/integration-profile.id: my-profile
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits: {}""", printer.getOutput());
    }

    @Test
    public void shouldUseNamespacedIntegrationProfile() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.integrationProfile = "my-namespace/my-profile";
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                    camel.apache.org/integration-profile.namespace: my-namespace
                    camel.apache.org/integration-profile.id: my-profile
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits: {}""", printer.getOutput());
    }

    @Test
    public void shouldAddSources() throws Exception {
        IntegrationRun command = createCommand();
        command.sources = new String[] { "classpath:route.yaml" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits: {}""", printer.getOutput());
    }

    @Test
    public void shouldAddConnects() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.connects = new String[] { "serving.knative.dev/v1:Service:foo" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    service-binding:
                      services:
                      - serving.knative.dev/v1:Service:foo""", printer.getOutput());
    }

    @Test
    public void shouldUsePodTemplate() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.podTemplate = "classpath:pod.yaml";
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  template:
                    spec:
                      containers:
                      - env:
                        - name: TEST
                          value: TEST
                        name: integration
                        volumeMounts:
                        - mountPath: /var/log
                          name: var-logs
                      volumes:
                      - emptyDir: {}
                        name: var-logs
                  traits: {}""", printer.getOutput());
    }

    @Test
    public void shouldAddConfigs() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.configs = new String[] { "secret:foo", "configmap:bar" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    mount:
                      configs:
                      - secret:foo
                      - configmap:bar""", printer.getOutput());
    }

    @Test
    public void shouldAddResources() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.resources = new String[] { "configmap:foo/file.txt" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    mount:
                      resources:
                      - configmap:foo/file.txt""", printer.getOutput());
    }

    @Test
    public void shouldAddOpenApis() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.openApis = new String[] { "configmap:openapi/spec.yaml" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    openapi:
                      configmaps:
                      - configmap:openapi/spec.yaml""", printer.getOutput());
    }

    @Test
    public void shouldUseImage() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.image = "quay.io/camel/demo-app:1.0";
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: demo-app-v1
                spec:
                  traits:
                    container:
                      image: quay.io/camel/demo-app:1.0""", printer.getOutput());
    }

    @Test
    public void shouldUseTraitWithListItem() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.traits
                = new String[] {
                        "toleration.taints=camel.apache.org/master:NoExecute:300", "camel.properties=camel.foo=bar",
                        "affinity.node-affinity-labels=kubernetes.io/hostname" };
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  flows:
                  - from:
                      uri: timer:tick
                      steps:
                      - setBody:
                          constant: Hello Camel !!!
                      - to: log:info
                  traits:
                    affinity:
                      nodeAffinityLabels:
                      - kubernetes.io/hostname
                    camel:
                      properties:
                      - camel.foo=bar
                    toleration:
                      taints:
                      - camel.apache.org/master:NoExecute:300""", printer.getOutput());
    }

    @Test
    public void shouldUseCompression() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.compression = true;
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals(
                """
                        apiVersion: camel.apache.org/v1
                        kind: Integration
                        metadata:
                          annotations:
                            camel.apache.org/operator.id: camel-k
                          name: route
                        spec:
                          sources:
                          - compression: true
                            content: ZFPBbtswDL3nK16TSwukybCjd3LTBDVWOECcrshRsWlbqC15Ej03fz/KSdYA08WgRD6+90jPJjO86pyMpwJswTUh7lQun8yWPChH2NjeFIq1NbiPs80DJCQHawjWobWOBCS3hp0+9ixXzRkQqnJELRn2CyAjGtHT7T5ZrVHqhlBofy6S5oPmWnC41h6DdR8oBUkVhQ6NVQNt5KI903BUKVdoU0nb7uR0VTPsYMj5WncLQdkHGdnmysSfYceeIvJg+4uGG7kXF+b4JTChyffFN0G6DynTy+P04QdOUtyqE4xl9J5ukOkzp46FqLBqu0Yrk9OXrH8dxIvDBcMeWUm6GmXAlrdpUDyZSeV4auYuWi6HYVioke7Cump5Vbd8FUfTbP04UpaaN9OQ92LT71478fZ4guqEUa6OwrNRQxjcOJ1x6EJhcOKzqebwl6kLyu10vuy60hPVtwlimDKYxhmSbIqnOEuyuWC8J/uX7dse7/FuF6f7ZJ1hu8Nqmz4n+2SbSrRBnB7wM0mf5yAxS9rQZ+cCfyGpg5FUhJleF+hKIOxHiH1HuS51LrpM1auKUNk/5ExYj45cq30Ypxd6haA0utU8bpH/X5S0mUxKZ9toAvROR2DdkotY5x9y45k6H56AR3jiJ1uczmE48gd4VoYjvFDTWKxUSw3u7u4uBWwjNLaKwiJP/gIAAP//
                            language: yaml
                            name: route.yaml
                          traits: {}""",
                removeLicenseHeader(printer.getOutput()));
    }

    private final Pattern comments = Pattern.compile("^\\s*#.*$", Pattern.MULTILINE);
    private final Pattern emptyLine = Pattern.compile("^[\\r?\\n]$", Pattern.MULTILINE);

    private String removeLicenseHeader(String yaml) {
        return emptyLine.matcher(comments.matcher(yaml).replaceAll("")).replaceAll("");
    }

    @Test
    public void shouldHandleUseFlowsDisabledOption() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.useFlows = false;
        command.output = "yaml";
        command.doCall();

        Assertions.assertEquals("""
                apiVersion: camel.apache.org/v1
                kind: Integration
                metadata:
                  annotations:
                    camel.apache.org/operator.id: camel-k
                  name: route
                spec:
                  sources:
                  - compression: false
                    content: |

                      from:
                        uri: timer:tick
                        steps:
                          - setBody:
                              constant: Hello Camel !!!
                          - to: log:info
                    language: yaml
                    name: route.yaml
                  traits: {}""", removeLicenseHeader(printer.getOutput()));
    }

    @Test
    public void shouldFailWithMissingOperatorId() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.useFlows = false;
        command.output = "yaml";

        command.operatorId = "";

        Assertions.assertEquals(-1, command.doCall());

        Assertions.assertEquals("Operator id must be set", printer.getOutput());
    }

    @Test
    public void shouldHandleUnsupportedOutputFormat() throws Exception {
        IntegrationRun command = createCommand();
        command.filePaths = new String[] { "classpath:route.yaml" };
        command.useFlows = false;
        command.output = "wrong";

        Assertions.assertEquals(-1, command.doCall());

        Assertions.assertEquals("Unsupported output format 'wrong' (supported: yaml, json)", printer.getOutput());
    }

    private IntegrationRun createCommand() {
        IntegrationRun command = new IntegrationRun(new CamelJBangMain().withPrinter(printer));
        command.withClient(kubernetesClient);
        return command;
    }