• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / MooseIDE / 21818695493

09 Feb 2026 09:02AM UTC coverage: 65.926% (+0.1%) from 65.829%
21818695493

push

github

web-flow
Merge pull request #1588 from moosetechnology/dead-code-heuristic-groups

Dead code heuristic groups

508 of 568 new or added lines in 21 files covered. (89.44%)

21882 of 33192 relevant lines covered (65.93%)

1.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.18
/src/MooseIDE-DeadCode/MiDeadJavaTestAnnotationRule.class.st
1
"
2
A heuristic to identify test methods based on their Java annotations
3

4
There are a number of annotations in Java that mark test methods (@Test, @Before, @BeforeEach,...)
5

6
Recognizes annotations from JUnit4 and JUnit5
7
"
8
Class {
9
        #name : 'MiDeadJavaTestAnnotationRule',
10
        #superclass : 'MiDeadAbstractJavaRule',
11
        #category : 'MooseIDE-DeadCode-Rules',
12
        #package : 'MooseIDE-DeadCode',
13
        #tag : 'Rules'
14
}
15

16
{ #category : 'visiting' }
NEW
17
MiDeadJavaTestAnnotationRule >> accept: aTMethod [
×
18

×
19
        ^self notDead: aTMethod 
×
20
]
×
21

22
{ #category : 'accessing' }
NEW
23
MiDeadJavaTestAnnotationRule >> description [ 
×
24

×
25
        ^super description ,
×
26
        'In Java, different annotations mark methods of test class
×
27
         (@Test, @Before, @BeforeEach,...)'
×
28
]
×
29

30
{ #category : 'accessing' }
NEW
31
MiDeadJavaTestAnnotationRule >> isForEntryPoint [
×
32

×
33
        ^true
×
34
]
×
35

36
{ #category : 'testing' }
37
MiDeadJavaTestAnnotationRule >> junit4Annotations [
2✔
38
        "from https://www.softwaretestinghelp.com/junit-annotations-tutorial/"
2✔
39

2✔
40
        ^{ 'Test' . 'Before' . 'After' . 'BeforeClass' . 'AfterClass' }
2✔
41
]
2✔
42

43
{ #category : 'testing' }
44
MiDeadJavaTestAnnotationRule >> junit5Annotations [
2✔
45
        "from https://junit.org/junit5/docs/current/user-guide/
2✔
46
        other possibilities: DisplayName, DisplayNameGeneration, Nested, Tag, Disabled, AutoClose, TempDir, ExtendWith, RegisterExtension"
2✔
47

2✔
48
        ^{ 'Test' . 'ParameterizedTest' . 'RepeatedTest' . 'TestFactory' . 'TestTemplate' . 'TestClassOrder' . 'TestMethodOrder' . 'TestInstance' . 'BeforeEach' . 'AfterEach' . 'BeforeAll' . 'AfterAll' . 'Timeout' }
2✔
49

2✔
50
]
2✔
51

52
{ #category : 'accessing' }
53
MiDeadJavaTestAnnotationRule >> name [
2✔
54

2✔
55
        ^super name , 'Java @Test method'
2✔
56
]
2✔
57

58
{ #category : 'testing' }
59
MiDeadJavaTestAnnotationRule >> notDead: aTMethod [
2✔
60

2✔
61
        aTMethod annotationInstances ifEmpty: [ ^false ].
2✔
62

2✔
63
        (aTMethod annotationInstances anySatisfy: [ :annotation |
2✔
64
                self junit4Annotations includes: annotation annotationType name ])
2✔
65
                ifTrue: [ ^true ].
2✔
66

2✔
67
        (aTMethod annotationInstances anySatisfy: [ :annotation |
2✔
68
                self junit5Annotations includes: annotation annotationType name ]) 
2✔
69
                ifTrue: [ ^true ].
2✔
70

2✔
71
        ^false
2✔
72
]
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc