• 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

93.83
/coverageTests/src/main/java/integration/tests/loops/WhileStatements.java
1
/*
2
 * MIT License
3
 * Copyright (c) 2006-2025 JMockit developers
4
 * See LICENSE file for full license text.
5
 */
6
package integration.tests.loops;
7

8
import org.slf4j.Logger;
9
import org.slf4j.LoggerFactory;
10

11
public class WhileStatements {
1✔
12

13
    /** The logger. */
14
    private static final Logger logger = LoggerFactory.getLogger(WhileStatements.class);
1✔
15

16
    void whileBlockInSeparateLines() {
17
        int i = 0;
1✔
18

19
        while (i < 5) {
1✔
20
            i++;
1✔
21
        }
22
    }
1✔
23

24
    void whileBlockInSingleLine(int i) {
25
        // @formatter:off
26
        while (i < 2) { i++; }
1✔
27
        // @formatter:on
28
    }
1✔
29

30
    int whileWithContinue(int i) {
31
        while (i < 2) {
1✔
32
            if (i == 1) {
1✔
33
                i = 3;
1✔
34
                continue;
1✔
35
            }
36

37
            i++;
1✔
38
        }
39

40
        return i;
1✔
41
    }
42

43
    int whileWithBreak(int i) {
44
        while (i < 2) {
1✔
45
            if (i == 1) {
1✔
46
                break;
1✔
47
            }
48

49
            i++;
1✔
50
        }
51

52
        return i;
1✔
53
    }
54

55
    void nestedWhile(int i, int j) {
56
        while (j < 2) {
1✔
57
            while (i < j) {
1!
58
                i++;
×
59
            }
60

61
            j++;
1✔
62
        }
63
    }
1✔
64

65
    void doWhileInSeparateLines() {
66
        int i = 0;
1✔
67

68
        do {
69
            i++;
1✔
70
        } while (i < 3);
1✔
71
    }
1✔
72

73
    void bothKindsOfWhileCombined(int i, int j) {
74
        while (true) {
75
            do {
76
                i++;
1✔
77
            }
78
            // @formatter:off
79
            while (i < j);
1✔
80
            // @formatter:on
81

82
            j++;
1✔
83

84
            if (j >= 2) {
1✔
85
                return;
1✔
86
            }
87
        }
88
    }
89

90
    void whileTrueEndingWithAnIf(int i) {
91
        while (true) {
92
            i++;
1✔
93

94
            if (i >= 2) {
1✔
95
                return;
1✔
96
            }
97
        }
98
    }
99

100
    void whileTrueStartingWithAnIf(int i) {
101
        while (true) {
102
            if (i >= 2) {
1✔
103
                return;
1✔
104
            }
105

106
            i++;
1✔
107
        }
108
    }
109

110
    void whileTrueWithoutExitCondition() {
111
        while (true) {
112
            doSomething();
×
113
        }
114
    }
115

116
    void whileTrueContainingTryFinally() {
117
        while (true) {
118
            try {
119
                doSomething();
×
120
            } finally {
121
                doNothing();
1✔
122
            }
×
123
        }
124
    }
125

126
    private static void doSomething() {
127
        throw new IllegalStateException();
1✔
128
    }
129

130
    private static void doNothing() {
131
    }
1✔
132

133
    int whileWithIfElse(int i) {
134
        while (i <= 2) {
1✔
135
            if (i % 2 == 0) {
1✔
136
                logger.info("even");
1✔
137
            } else {
138
                logger.info("odd");
1✔
139
            }
140

141
            i++;
1✔
142
        }
143

144
        return i;
1✔
145
    }
146
}
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