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

Add initial support for jpos injections in tests. #243

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rename test module as suggested by @ar and @fgonzal
Also:
- rename unused parameter to ignored.
- fixed code example in README.md
  • Loading branch information
alcarraz committed Oct 24, 2023
commit 9ae3486d26acd0a4cf6e5bb50ab78677967b1c37
9 changes: 5 additions & 4 deletions modules/test/README.md → modules/testcore/README.md
Original file line number Diff line number Diff line change
@@ -9,13 +9,14 @@ In the following example, if the logger does not already exist, a default one, t
```java
@ExtendWith(LogSupplierExtension.class)
class LogTest {
@LogSource (logger="Q2", realm="log-test")
@LogSource(logger = "Q2", realm = "log-test")
Log log;

@Test
public void testDebug(){
public void testDebug() {
log.debug("debug called");
}
}
```


@@ -71,4 +72,4 @@ class MUXSupplierExtensionTest {
assertSame(response, mux.request(request, 1000L));
}
}
```
```
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -63,14 +63,13 @@ public void beforeEach(ExtensionContext context) throws IllegalArgumentException
*
* @param parameterContext the context for the parameter for which an argument should
* be resolved; never {@code null}
* @param extensionContext the extension context for the {@code Executable}
* about to be invoked; never {@code null}
* @param ignored unused
* @return {@code true} if this resolver can resolve an argument for the parameter
* @see #resolveParameter
* @see ParameterContext
*/
@Override
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext ignored) throws ParameterResolutionException {
return parameterContext.isAnnotated(LogSource.class) && parameterContext.getTarget().map(Object::getClass).filter(c -> c.isAssignableFrom(LogSource.class)).isPresent();
}

Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ protected void setUp(ExtensionContext context, boolean beforeAll) {
* @param afterAll if this is for an afterAll method unregister only static muxes otherwise only instences.
*/
protected void tearDown(ExtensionContext context, boolean afterAll){
runOnFields(context, afterAll, (f, annotation) -> NameRegistrar.unregister("mux." + annotation.name()));
runOnFields(context, afterAll, (ignored, annotation) -> NameRegistrar.unregister("mux." + annotation.name()));

}
/**
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -46,8 +46,8 @@ include ':modules:core',
':modules:seqno',
':modules:db-flyway',
':modules:elasticsearch',
':modules:bom'
':modules:test'
':modules:bom',
':modules:testcore'


rootProject.name = 'jposee'