Add initial support for jpos injections in tests. #243
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This first commit adds support for injecting a log source, and a mocked MUX for jPOS based application JUnit tests.
It is intended to be used by test classpaths in order to avoid boilerplate for logging or mocked versions of jpos or jPOS-EE components such as
MUX
andDB
objects(currently, only MUX is supported). Actually for jPOS-EE specific components a test module by referenced module maybe necessary to avoid unneeded dependencies.This PR is marked as draft for discussion, specially the classes and annotations names. But if it seems OK, then we can merge it as is
Module for aiding in unit tests
This module provides annotations to inject some mock or frequently needed objects during testing.
For example, it provides an injection for a
Log
object, and aMUX
mock.Log
injection exampleIn the following example, if the logger does not already exist, a default one, that logs to standard output is created with the given
logger
name, and assigned to theLog
instance.MUX
mocking injection exampleThis test class is actually executed in this module's test.