Skip to content

slf4j-test feature: warn if an expectation is created but never asserted on #48

Description

@keturn

With this sort of case

 LogAssert expect = TestLoggers.sys().expect("org.spf4j.test", Level.WARN,
            LogMatchers.hasFormat("Booo"));
  LOG.warn("Booo", new RuntimeException());
  // oops, lost the `assertObservation`!

the test will not fail if it does not produce the expected logs.

The @ExpectLog annotation avoids this hazard, but it is limited by the annotation requirement of only using compile-time values.

It'd be nice to have ways that make sure the assertion always runs and that still let you use matchers.

(Exactly how that looks probably depends on the test framework.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions