• 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

48.09
/coverageTests/src/main/java/integration/tests/BooleanExpressions.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;
7

8
/**
9
 * The Class BooleanExpressions.
10
 */
11
public final class BooleanExpressions {
1✔
12

13
    /**
14
     * Eval 1.
15
     *
16
     * @param x
17
     *            the x
18
     * @param y
19
     *            the y
20
     * @param z
21
     *            the z
22
     *
23
     * @return true, if successful
24
     */
25
    public boolean eval1(boolean x, boolean y, int z) {
26
        return x && (y || z > 0);
1!
27
    }
28

29
    /**
30
     * Eval 2.
31
     *
32
     * @param x
33
     *            the x
34
     * @param y
35
     *            the y
36
     * @param z
37
     *            the z
38
     *
39
     * @return true, if successful
40
     */
41
    public boolean eval2(boolean x, boolean y, int z) {
42
        return x && (y || z > 0);
1✔
43
    }
44

45
    /**
46
     * Eval 3.
47
     *
48
     * @param x
49
     *            the x
50
     * @param y
51
     *            the y
52
     * @param z
53
     *            the z
54
     *
55
     * @return true, if successful
56
     */
57
    public boolean eval3(boolean x, boolean y, boolean z) {
58
        return x && (y || z); // LOAD 1 IFEQ L1, LOAD 2 IFNE L2, LOAD 3 IFEQ L1, [L2 1 GOTO L3], [L1 0 L3 RETURN]
1✔
59
    }
60

61
    /**
62
     * Eval 4.
63
     *
64
     * @param x
65
     *            the x
66
     * @param y
67
     *            the y
68
     * @param z
69
     *            the z
70
     *
71
     * @return true, if successful
72
     */
73
    public boolean eval4(boolean x, boolean y, boolean z) {
74
        return x && (!y || z);
1!
75
    }
76

77
    /**
78
     * Eval 5.
79
     *
80
     * @param a
81
     *            the a
82
     * @param b
83
     *            the b
84
     * @param c
85
     *            the c
86
     *
87
     * @return true, if successful
88
     */
89
    public boolean eval5(boolean a, boolean b, boolean c) {
90
        if (a) {
1!
91
            return true;
×
92
        }
93
        if (b || c) {
1!
94
            return false;
1✔
95
        }
96

97
        return !c;
1!
98
    }
99

100
    /**
101
     * Checks if is same type ignoring auto boxing.
102
     *
103
     * @param firstType
104
     *            the first type
105
     * @param secondType
106
     *            the second type
107
     *
108
     * @return true, if is same type ignoring auto boxing
109
     */
110
    static boolean isSameTypeIgnoringAutoBoxing(Class<?> firstType, Class<?> secondType) {
111
        return firstType == secondType || firstType.isPrimitive() && isWrapperOfPrimitiveType(firstType, secondType)
1!
112
                || secondType.isPrimitive() && isWrapperOfPrimitiveType(secondType, firstType);
1!
113
    }
114

115
    /**
116
     * Checks if is wrapper of primitive type.
117
     *
118
     * @param primitiveType
119
     *            the primitive type
120
     * @param otherType
121
     *            the other type
122
     *
123
     * @return true, if is wrapper of primitive type
124
     */
125
    static boolean isWrapperOfPrimitiveType(Class<?> primitiveType, Class<?> otherType) {
126
        return primitiveType == int.class && otherType == Integer.class
1!
127
                || primitiveType == long.class && otherType == Long.class
128
                || primitiveType == double.class && otherType == Double.class
129
                || primitiveType == float.class && otherType == Float.class
130
                || primitiveType == boolean.class && otherType == Boolean.class;
131
    }
132

133
    /**
134
     * Simply returns input.
135
     *
136
     * @param b
137
     *            the b
138
     *
139
     * @return true, if successful
140
     */
141
    public boolean simplyReturnsInput(boolean b) {
142
        return b;
1✔
143
    }
144

145
    /**
146
     * Returns negated input.
147
     *
148
     * @param b
149
     *            the b
150
     *
151
     * @return true, if successful
152
     */
153
    public boolean returnsNegatedInput(boolean b) {
154
        return !b; // LOAD 1 IFNE L1, 1 GOTO L2, L1 0 L2 RETURN
1!
155
    }
156

157
    /**
158
     * Returns trivial result from input after if else.
159
     *
160
     * @param b
161
     *            the b
162
     * @param i
163
     *            the i
164
     *
165
     * @return true, if successful
166
     */
167
    public boolean returnsTrivialResultFromInputAfterIfElse(boolean b, int i) {
168
        String s;
169

170
        if (b) {
1✔
171
            s = "one";
1✔
172
        } else {
173
            s = "two";
1✔
174
        }
175

176
        return i != 0; // LOAD 2 IFEQ L1, 1 GOTO L2, L1 0 L2 RETURN
1✔
177
    }
178

179
    /**
180
     * Returns result previously computed from input.
181
     *
182
     * @param b
183
     *            the b
184
     * @param i
185
     *            the i
186
     *
187
     * @return true, if successful
188
     */
189
    public boolean returnsResultPreviouslyComputedFromInput(boolean b, int i) {
190
        String s = b ? "a" : "b";
1✔
191
        boolean res;
192

193
        if (i != 0) {
1✔
194
            res = true;
1✔
195
        } else {
196
            res = false;
1✔
197
            System.out.checkError();
1✔
198
        }
199

200
        return res;
1✔
201
    }
202

203
    /**
204
     * Method with too many conditions for path analysis.
205
     *
206
     * @param i
207
     *            the i
208
     * @param j
209
     *            the j
210
     * @param b
211
     *            the b
212
     *
213
     * @return true, if successful
214
     */
215
    public boolean methodWithTooManyConditionsForPathAnalysis(int i, int j, boolean b) {
216
        if (i > 0 && j < 5 || (b ? i > 1 : j > 5) || (i <= 3 || j >= 4) && b) {
×
217
            return i + j == 3 == b;
×
218
        }
219
        if (i < 0 || j < 0) {
×
220
            return i < j;
×
221
        }
222

223
        return b;
×
224
    }
225

226
    /**
227
     * Returns negated input from local variable.
228
     *
229
     * @param b
230
     *            the b
231
     *
232
     * @return true, if successful
233
     */
234
    public boolean returnsNegatedInputFromLocalVariable(boolean b) {
235
        return !b; // LOAD 1 IFNE L1, [1 GOTO L2], [L1 0], L2 STORE 2, L3 LOAD 2 RETURN
×
236
    }
237
}
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