You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "galleog (via GitHub)" <gi...@apache.org> on 2026/04/16 07:56:31 UTC

[I] LogCapturingExtension depends on JUnit4 [pekko]

galleog opened a new issue, #2864:
URL: https://github.com/apache/pekko/issues/2864

   JUnit5 extension LogCapturingExtension uses Logger for LogCapturing that is for JUnit4. So if you use the extension you have to add extra dependecies on JUnit4.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LogCapturingExtension depends on JUnit4 [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on issue #2864:
URL: https://github.com/apache/pekko/issues/2864#issuecomment-4258711252

   I analyzed this issue on the current `main` branch (HEAD: `f62b01e`) and can confirm **the problem still exists**.
   
   ### Root Cause
   
   `LogCapturingExtension` is a JUnit 5 `InvocationInterceptor`, but line 27 initializes its logger using `classOf[LogCapturing]`:
   
   ```scala
   // actor-testkit-typed/src/main/scala/org/apache/pekko/actor/testkit/typed/javadsl/LogCapturingExtension.scala
   // Line 27
   private val myLogger = LoggerFactory.getLogger(classOf[LogCapturing])
   ```
   
   Since both classes live in the same package (`javadsl`), the unqualified `classOf[LogCapturing]` resolves to `javadsl.LogCapturing` — which is the **JUnit 4 `TestRule`** class (imports `org.junit.rules.TestRule` at lines 18–20 of `javadsl/LogCapturing.scala`). Loading this class at runtime requires JUnit 4 on the classpath.
   
   ### Dependency Evidence
   
   In `project/Dependencies.scala`:
   - Both JUnit 4 and JUnit 5 are declared as `"optional;provided;test"` (lines 197–198)
   - The `actorTestkitTyped` module lists both `Provided.junit` and `Provided.junit6` (lines 238–245)
   
   Because both are `optional`, neither is transitively provided to downstream consumers. A pure JUnit 5 user gets no JUnit 4 transitively, yet `LogCapturingExtension` forces it at runtime via the `classOf[LogCapturing]` reference.
   
   ### Proposed Fix
   
   One-line change in `LogCapturingExtension.scala` line 27:
   
   ```diff
   -private val myLogger = LoggerFactory.getLogger(classOf[LogCapturing])
   +private val myLogger = LoggerFactory.getLogger(classOf[LogCapturingExtension])
   ```
   
   This removes the implicit JUnit 4 class reference from the JUnit 5 extension entirely.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LogCapturingExtension depends on JUnit4 [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on issue #2864:
URL: https://github.com/apache/pekko/issues/2864#issuecomment-4258754326

   I will send a fix soon


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LogCapturingExtension depends on JUnit4 [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on issue #2864:
URL: https://github.com/apache/pekko/issues/2864#issuecomment-4258488290

   feel free to send a pr and fix this, thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LogCapturingExtension depends on JUnit4 [pekko]

Posted by "galleog (via GitHub)" <gi...@apache.org>.
galleog commented on issue #2864:
URL: https://github.com/apache/pekko/issues/2864#issuecomment-4258670499

   I'm using 1.5.0.
   The point is code doesn't run if you use JUnit5 and its LogCapturingExtension because it requres JUnit4 dependencies so I have to add for example junit-vintage-engine though I use only JUnit5 tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LogCapturingExtension depends on JUnit4 [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #2864:
URL: https://github.com/apache/pekko/issues/2864#issuecomment-4258533344

   the junit dependencies are optional - https://repo1.maven.org/maven2/org/apache/pekko/pekko-actor-testkit-typed_3/1.5.0/pekko-actor-testkit-typed_3-1.5.0.pom


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LogCapturingExtension depends on JUnit4 [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning closed issue #2864: LogCapturingExtension depends on JUnit4
URL: https://github.com/apache/pekko/issues/2864


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LogCapturingExtension depends on JUnit4 [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #2864:
URL: https://github.com/apache/pekko/issues/2864#issuecomment-4258736088

   @He-Pin makes sense - if we get that change merged to main branch, we can backport it to 1.6 branch


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] LogCapturingExtension depends on JUnit4 [pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #2864:
URL: https://github.com/apache/pekko/issues/2864#issuecomment-4258455515

   Which pekko version are you using?
   Pekko 2.0.0-M2 should hopefully be released in the next few weeks and will contain extra changes in the move to Jupiter Junit (Junit 6).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org