Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instantiate ExpectedLogging from package name #8

Open
bjansen opened this issue Nov 29, 2023 · 0 comments
Open

Instantiate ExpectedLogging from package name #8

bjansen opened this issue Nov 29, 2023 · 0 comments

Comments

@bjansen
Copy link

bjansen commented Nov 29, 2023

Hi,

Before opening PRs I'd like to discuss a possible improvement in your library: instantiating an ExpectedLogging from a package name in addition to a class. The idea behind this is that (in my case) some of the generated logs are business requirements, that's why I'm asserting them in unit tests. It doesn't really matter which class outputs the log, as long as the log is present then my business requirement is met. Also, refactorings might move a logged message from one class to another, and in my opinion that shouldn't affect tests.

So what I'm proposing is something like this:

    public static ExpectedLogging forPackage(String packageName) {
        return new ExpectedLogging(packageName);
    }

Or maybe even a more general:

    public static ExpectedLogging forLogger(String loggerName) {
        return new ExpectedLogging(loggerName);
    }

Or perhaps just making the existing constructor public?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant