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

hazendaz / jmockit1 / 496

15 Nov 2025 05:33PM UTC coverage: 72.192% (-0.008%) from 72.2%
496

push

github

web-flow
Merge pull request #412 from hazendaz/renovate/major-spring-core

Update spring core to v7 (major)

5677 of 8360 branches covered (67.91%)

Branch coverage included in aggregate %.

11922 of 16018 relevant lines covered (74.43%)

0.74 hits per line

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

41.86
/main/src/main/java/mockit/integration/junit4/FakeRunNotifier.java
1
/*
2
 * MIT License
3
 * Copyright (c) 2006-2025 JMockit developers
4
 * See LICENSE file for full license text.
5
 */
6
package mockit.integration.junit4;
7

8
import edu.umd.cs.findbugs.annotations.NonNull;
9

10
import mockit.Invocation;
11
import mockit.Mock;
12
import mockit.MockUp;
13
import mockit.coverage.testRedundancy.JUnitListener;
14
import mockit.coverage.testRedundancy.TestCoverage;
15
import mockit.integration.TestRunnerDecorator;
16
import mockit.internal.faking.FakeInvocation;
17
import mockit.internal.state.TestRun;
18

19
import org.junit.runner.Description;
20
import org.junit.runner.Result;
21
import org.junit.runner.notification.RunNotifier;
22

23
/**
24
 * Startup fake which works in conjunction with {@link JUnit4TestRunnerDecorator} to provide JUnit 4.5+ integration.
25
 * <p>
26
 * This class is not supposed to be accessed from user code. JMockit will automatically load it at startup.
27
 */
28
public final class FakeRunNotifier extends MockUp<RunNotifier> {
1✔
29
    @Mock
30
    public static void fireTestRunStarted(Invocation invocation, Description description) {
31
        RunNotifier it = invocation.getInvokedInstance();
×
32
        assert it != null;
×
33

34
        TestCoverage testCoverage = TestCoverage.INSTANCE;
×
35

36
        if (testCoverage != null) {
×
37
            it.addListener(new JUnitListener(testCoverage));
×
38
        }
39

40
        prepareToProceed(invocation);
×
41
        it.fireTestRunStarted(description);
×
42
    }
×
43

44
    private static void prepareToProceed(@NonNull Invocation invocation) {
45
        ((FakeInvocation) invocation).prepareToProceedFromNonRecursiveMock();
1✔
46
    }
1✔
47

48
    @Mock
49
    public static void fireTestStarted(Invocation invocation, Description description) {
50
        Class<?> currentTestClass = TestRun.getCurrentTestClass();
1✔
51

52
        if (currentTestClass != null) {
1✔
53
            Class<?> newTestClass = description.getTestClass();
1✔
54

55
            if (newTestClass == null || !currentTestClass.isAssignableFrom(newTestClass)) {
1!
56
                TestRunnerDecorator.cleanUpMocksFromPreviousTestClass();
1✔
57
            }
58
        }
59

60
        prepareToProceed(invocation);
1✔
61

62
        RunNotifier it = invocation.getInvokedInstance();
1✔
63
        assert it != null;
1!
64
        it.fireTestStarted(description);
1✔
65
    }
1✔
66

67
    @Mock
68
    public static void fireTestRunFinished(Invocation invocation, Result result) {
69
        TestRun.enterNoMockingZone();
×
70

71
        try {
72
            TestRunnerDecorator.cleanUpAllMocks();
×
73

74
            prepareToProceed(invocation);
×
75

76
            RunNotifier it = invocation.getInvokedInstance();
×
77
            assert it != null;
×
78
            it.fireTestRunFinished(result);
×
79
        } finally {
80
            TestRun.exitNoMockingZone();
×
81
        }
82
    }
×
83
}
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