Skip to content

Tags: stefanbirkner/system-lambda

Tags

system-lambda-1.2.1

Toggle system-lambda-1.2.1's commit message

Verified

This commit was signed with the committer’s verified signature.
stefanbirkner Stefan Birkner
Replace assertThrownBy with assertThrows

assertThrows is the correct method name of JUnit Jupiter's assertion for
exceptions. All examples use JUnit Jupiter for assertions.

system-lambda-1.2.0

Toggle system-lambda-1.2.0's commit message

Verified

This commit was signed with the committer’s verified signature.
stefanbirkner Stefan Birkner
Add methods for tapping err and out simultaneously

The output of command-line applications is usually the output to the
standard output stream and the error output stream intermixed. The new
methods allow capturing the intermixed output.

    @test
    void application_writes_text_to_System_err_and_out(
    ) throws Exception {
      String text = tapSystemErrAndOut(() -> {
        System.err.print("text from err");
        System.out.print("text from out");
      });
      assertEquals("text from errtext from out", text);
    }

    @test
    void application_writes_mutliple_lines_to_System_err_and_out(
    ) throws Exception {
      String text = tapSystemErrAndOutNormalized(() -> {
        System.err.println("text from err");
        System.out.println("text from out");
      });
      assertEquals("text from err\ntext from out\n", text);
    }

system-lambda-1.1.1

Toggle system-lambda-1.1.1's commit message

Verified

This commit was signed with the committer’s verified signature.
stefanbirkner Stefan Birkner
Fix examples for tapping System.err and System.out

println and '\n' chars have not been used correctly.

system-lambda-1.1.0

Toggle system-lambda-1.1.0's commit message

Verified

This commit was signed with the committer’s verified signature.
stefanbirkner Stefan Birkner
Support Callable for "withEnvironmentVariable"

This allows to write more precise and readable tests. The assertion can
be outside of the "withEnvironmentVariable" statement and "execute" can
be called with a one-line Lambda expression. E.g.

    @test
    void execute_code_with_environment_variables(
    ) throws Exception {
      String value = withEnvironmentVariable("key", "the value")
        .execute(() -> System.getenv("key"));
      assertEquals("the value", value);
    }

system-lambda-1.0.0

Toggle system-lambda-1.0.0's commit message

Verified

This commit was signed with the committer’s verified signature.
stefanbirkner Stefan Birkner
System Lambda 1.0.0