Skip to content

SimpleJobLauncher not using jobIncrementer #4397

Open
@songmag

Description

@songmag

Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:

Bug description
A clear and concise description of what the bug is about.

Simple Job Launcher not using JobParametersIncrementer

i want same result using that cli run but the test util is using the simple job launcher

so, i want to change the simpleJobLauncher

image

Environment
Please provide as many details as possible: Spring Batch version, Java version, which database you use if any, etc
spring batch 4.3
java 11

Steps to reproduce
Steps to reproduce the issue.

Expected behavior
A clear and concise description of what you expected to happen.

        jobLauncherTestUtils.setJob(job);
        var result = jobLauncherTestUtils.launchJob();
        Assertions.assertThat(result.getJobParameters().getString("year")).isEqualTo(DateTimeFormatter.ofPattern("yyyyMM").format(LocalDateTime.now()));
        Assertions.assertThat(result.getStatus()).isEqualTo(BatchStatus.COMPLETED);

Minimal Complete Reproducible example
Please provide a failing test or a minimal complete verifiable example that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.

        jobLauncherTestUtils.setJob(job);
        var result = jobLauncherTestUtils.launchJob(job.getJobParametersIncrementer().getNext(jobLauncherTestUtils.getUniqueJobParameters()));
        Assertions.assertThat(result.getJobParameters().getString("year")).isEqualTo(DateTimeFormatter.ofPattern("yyyyMM").format(LocalDateTime.now()));
        Assertions.assertThat(result.getStatus()).isEqualTo(BatchStatus.COMPLETED);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions