[ 
https://issues.apache.org/jira/browse/COLLECTIONS-884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ben Manes updated COLLECTIONS-884:
----------------------------------
    Description: 
I use AbstractMapTest as an additional test suite for Caffeine Cache. When 
refactoring tests and running it in Eclipse, I noticed the following warning.
{noformat}
Jan 31, 2026 12:32:52 PM 
org.junit.platform.launcher.core.DiscoveryIssueNotifier logIssuesWARNING: 
TestEngine with ID 'junit-jupiter' encountered 3 non-critical issues during 
test discovery:

(1) [WARNING] Inner class 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapEntrySet' looks 
like it was intended to be a test class but will not be executed. It must be 
static or annotated with @Nested.
    Source: ClassSource [className = 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapEntrySet', 
filePosition = null]
            at 
org.apache.commons.collections4.map.AbstractMapTest$TestMapEntrySet.<no-method>(SourceFile:0)
(2) [WARNING] Inner class 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapKeySet' looks like 
it was intended to be a test class but will not be executed. It must be static 
or annotated with @Nested.
    Source: ClassSource [className = 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapKeySet', 
filePosition = null]
            at 
org.apache.commons.collections4.map.AbstractMapTest$TestMapKeySet.<no-method>(SourceFile:0)
(3) [WARNING] Inner class 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapValues' looks like 
it was intended to be a test class but will not be executed. It must be static 
or annotated with @Nested.
    Source: ClassSource [className = 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapValues', 
filePosition = null]
            at 
org.apache.commons.collections4.map.AbstractMapTest$TestMapValues.<no-method>(SourceFile:0){noformat}
I verified that those nested tests are not being run and added them 
successfully.
{code:java}
@Nested final class MapKeySetTest extends TestMapKeySet {}
@Nested final class MapValuesTest extends TestMapValues {}
@Nested final class MapEntrySetTest extends TestMapEntrySet {} {code}
This looks like an innocent mistake when you converted from JUnit 3. I suspect 
that its not running in your suite and needs the missing annotation. It would 
be prudent to review the other abstract test suites.

  was:
I use AbstractMapTest as an additional test suite for Caffeine Cache. When 
refactoring tests and running it in Eclipse, I noticed the following warning.
{noformat}
Jan 31, 2026 12:32:52 PM 
org.junit.platform.launcher.core.DiscoveryIssueNotifier logIssuesWARNING: 
TestEngine with ID 'junit-jupiter' encountered 3 non-critical issues during 
test discovery:
(1) [WARNING] Inner class 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapEntrySet' looks 
like it was intended to be a test class but will not be executed. It must be 
static or annotated with @Nested.    Source: ClassSource [className = 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapEntrySet', 
filePosition = null]            at 
org.apache.commons.collections4.map.AbstractMapTest$TestMapEntrySet.<no-method>(SourceFile:0)
(2) [WARNING] Inner class 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapKeySet' looks like 
it was intended to be a test class but will not be executed. It must be static 
or annotated with @Nested.    Source: ClassSource [className = 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapKeySet', 
filePosition = null]            at 
org.apache.commons.collections4.map.AbstractMapTest$TestMapKeySet.<no-method>(SourceFile:0)
(3) [WARNING] Inner class 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapValues' looks like 
it was intended to be a test class but will not be executed. It must be static 
or annotated with @Nested.    Source: ClassSource [className = 
'org.apache.commons.collections4.map.AbstractMapTest$TestMapValues', 
filePosition = null]            at 
org.apache.commons.collections4.map.AbstractMapTest$TestMapValues.<no-method>(SourceFile:0){noformat}
I verified that those nested tests are not being run and added them 
successfully.
{code:java}
@Nested final class MapKeySetTest extends TestMapKeySet {}
@Nested final class MapValuesTest extends TestMapValues {}
@Nested final class MapEntrySetTest extends TestMapEntrySet {} {code}
This looks like an innocent mistake when you converted from JUnit 3. I suspect 
that its not running in your suite and needs the missing annotation. It would 
be prudent to review the other abstract test suites.


> AbstractMapTest not running nested tests
> ----------------------------------------
>
>                 Key: COLLECTIONS-884
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-884
>             Project: Commons Collections
>          Issue Type: Improvement
>          Components: Map
>    Affects Versions: 4.5.0
>            Reporter: Ben Manes
>            Priority: Major
>
> I use AbstractMapTest as an additional test suite for Caffeine Cache. When 
> refactoring tests and running it in Eclipse, I noticed the following warning.
> {noformat}
> Jan 31, 2026 12:32:52 PM 
> org.junit.platform.launcher.core.DiscoveryIssueNotifier logIssuesWARNING: 
> TestEngine with ID 'junit-jupiter' encountered 3 non-critical issues during 
> test discovery:
> (1) [WARNING] Inner class 
> 'org.apache.commons.collections4.map.AbstractMapTest$TestMapEntrySet' looks 
> like it was intended to be a test class but will not be executed. It must be 
> static or annotated with @Nested.
>     Source: ClassSource [className = 
> 'org.apache.commons.collections4.map.AbstractMapTest$TestMapEntrySet', 
> filePosition = null]
>             at 
> org.apache.commons.collections4.map.AbstractMapTest$TestMapEntrySet.<no-method>(SourceFile:0)
> (2) [WARNING] Inner class 
> 'org.apache.commons.collections4.map.AbstractMapTest$TestMapKeySet' looks 
> like it was intended to be a test class but will not be executed. It must be 
> static or annotated with @Nested.
>     Source: ClassSource [className = 
> 'org.apache.commons.collections4.map.AbstractMapTest$TestMapKeySet', 
> filePosition = null]
>             at 
> org.apache.commons.collections4.map.AbstractMapTest$TestMapKeySet.<no-method>(SourceFile:0)
> (3) [WARNING] Inner class 
> 'org.apache.commons.collections4.map.AbstractMapTest$TestMapValues' looks 
> like it was intended to be a test class but will not be executed. It must be 
> static or annotated with @Nested.
>     Source: ClassSource [className = 
> 'org.apache.commons.collections4.map.AbstractMapTest$TestMapValues', 
> filePosition = null]
>             at 
> org.apache.commons.collections4.map.AbstractMapTest$TestMapValues.<no-method>(SourceFile:0){noformat}
> I verified that those nested tests are not being run and added them 
> successfully.
> {code:java}
> @Nested final class MapKeySetTest extends TestMapKeySet {}
> @Nested final class MapValuesTest extends TestMapValues {}
> @Nested final class MapEntrySetTest extends TestMapEntrySet {} {code}
> This looks like an innocent mistake when you converted from JUnit 3. I 
> suspect that its not running in your suite and needs the missing annotation. 
> It would be prudent to review the other abstract test suites.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to