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

DefaultMocks of SimpleLogger uses default answer RETURNS_DEFAULTS #204

Closed
markusschaefer opened this issue May 21, 2024 · 2 comments · Fixed by #205
Closed

DefaultMocks of SimpleLogger uses default answer RETURNS_DEFAULTS #204

markusschaefer opened this issue May 21, 2024 · 2 comments · Fixed by #205
Assignees
Labels
enhancement New feature or request.

Comments

@markusschaefer
Copy link
Contributor

Describe the bug
The DefaultMock Spies in LoggerMock are created with the default Answer RETURNS_DEFAULTS from Mockito.

To Reproduce
Create a Junit Test with slf4j2-mock binding to slf4j and a simplelogger.properties. Don't bind any mock to the logger, so that the Default Mock will be used.

Expected behavior
As the DefaultMocks are Spies of SimpleLogger, the default Answer should be CALLS_REAL_METHODS, so that the SimpleLogger is used with the existing simplelogger.properties.

Additional context
The project contains a lot of unit Tests, but only a few needs mocking of the loggers. All other tests should have a normal logging behaviour with logging to System.out or a file.

@vitalijr2
Copy link
Contributor

The project contains a lot of unit Tests, but only a few needs mocking of the loggers. All other tests should have a normal logging behaviour with logging to System.out or a file.

The good idea.

@slawekjaranowski
Copy link
Member

Thanks for idea ... I will check it

@slawekjaranowski slawekjaranowski linked a pull request Nov 8, 2024 that will close this issue
@slawekjaranowski slawekjaranowski added the enhancement New feature or request. label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request.
Development

Successfully merging a pull request may close this issue.

3 participants