Assert.java

1
package org.junit;
2
3
import org.hamcrest.Matcher;
4
import org.hamcrest.MatcherAssert;
5
import org.junit.internal.ArrayComparisonFailure;
6
import org.junit.internal.ExactComparisonCriteria;
7
import org.junit.internal.InexactComparisonCriteria;
8
9
/**
10
 * A set of assertion methods useful for writing tests. Only failed assertions
11
 * are recorded. These methods can be used directly:
12
 * <code>Assert.assertEquals(...)</code>, however, they read better if they
13
 * are referenced through static import:<br/>
14
 *
15
 * <pre>
16
 * import static org.junit.Assert.*;
17
 *    ...
18
 *    assertEquals(...);
19
 * </pre>
20
 *
21
 * @see AssertionError
22
 * @since 4.0
23
 */
24
public class Assert {
25
    /**
26
     * Protect constructor since it is a static only class
27
     */
28
    protected Assert() {
29
    }
30
31
    /**
32
     * Asserts that a condition is true. If it isn't it throws an
33
     * {@link AssertionError} with the given message.
34
     *
35
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
36
     * okay)
37
     * @param condition condition to be checked
38
     */
39
    static public void assertTrue(String message, boolean condition) {
40 1 1. assertTrue : negated conditional → KILLED
        if (!condition) {
41 1 1. assertTrue : removed call to org/junit/Assert::fail → NO_COVERAGE
            fail(message);
42
        }
43
    }
44
45
    /**
46
     * Asserts that a condition is true. If it isn't it throws an
47
     * {@link AssertionError} without a message.
48
     *
49
     * @param condition condition to be checked
50
     */
51
    static public void assertTrue(boolean condition) {
52 1 1. assertTrue : removed call to org/junit/Assert::assertTrue → SURVIVED
        assertTrue(null, condition);
53
    }
54
55
    /**
56
     * Asserts that a condition is false. If it isn't it throws an
57
     * {@link AssertionError} with the given message.
58
     *
59
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
60
     * okay)
61
     * @param condition condition to be checked
62
     */
63
    static public void assertFalse(String message, boolean condition) {
64 2 1. assertFalse : negated conditional → NO_COVERAGE
2. assertFalse : removed call to org/junit/Assert::assertTrue → NO_COVERAGE
        assertTrue(message, !condition);
65
    }
66
67
    /**
68
     * Asserts that a condition is false. If it isn't it throws an
69
     * {@link AssertionError} without a message.
70
     *
71
     * @param condition condition to be checked
72
     */
73
    static public void assertFalse(boolean condition) {
74 1 1. assertFalse : removed call to org/junit/Assert::assertFalse → NO_COVERAGE
        assertFalse(null, condition);
75
    }
76
77
    /**
78
     * Fails a test with the given message.
79
     *
80
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
81
     * okay)
82
     * @see AssertionError
83
     */
84
    static public void fail(String message) {
85 1 1. fail : negated conditional → KILLED
        if (message == null) {
86
            throw new AssertionError();
87
        }
88
        throw new AssertionError(message);
89
    }
90
91
    /**
92
     * Fails a test with no message.
93
     */
94
    static public void fail() {
95 1 1. fail : removed call to org/junit/Assert::fail → KILLED
        fail(null);
96
    }
97
98
    /**
99
     * Asserts that two objects are equal. If they are not, an
100
     * {@link AssertionError} is thrown with the given message. If
101
     * <code>expected</code> and <code>actual</code> are <code>null</code>,
102
     * they are considered equal.
103
     *
104
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
105
     * okay)
106
     * @param expected expected value
107
     * @param actual actual value
108
     */
109
    static public void assertEquals(String message, Object expected,
110
            Object actual) {
111 1 1. assertEquals : negated conditional → KILLED
        if (equalsRegardingNull(expected, actual)) {
112
            return;
113 2 1. assertEquals : negated conditional → KILLED
2. assertEquals : negated conditional → KILLED
        } else if (expected instanceof String && actual instanceof String) {
114 1 1. assertEquals : negated conditional → KILLED
            String cleanMessage = message == null ? "" : message;
115
            throw new ComparisonFailure(cleanMessage, (String) expected,
116
                    (String) actual);
117
        } else {
118 1 1. assertEquals : removed call to org/junit/Assert::failNotEquals → KILLED
            failNotEquals(message, expected, actual);
119
        }
120
    }
121
122
    private static boolean equalsRegardingNull(Object expected, Object actual) {
123 1 1. equalsRegardingNull : negated conditional → KILLED
        if (expected == null) {
124 3 1. equalsRegardingNull : negated conditional → KILLED
2. equalsRegardingNull : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
3. equalsRegardingNull : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
            return actual == null;
125
        }
126
127 1 1. equalsRegardingNull : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return isEquals(expected, actual);
128
    }
129
130
    private static boolean isEquals(Object expected, Object actual) {
131 1 1. isEquals : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return expected.equals(actual);
132
    }
133
134
    /**
135
     * Asserts that two objects are equal. If they are not, an
136
     * {@link AssertionError} without a message is thrown. If
137
     * <code>expected</code> and <code>actual</code> are <code>null</code>,
138
     * they are considered equal.
139
     *
140
     * @param expected expected value
141
     * @param actual the value to check against <code>expected</code>
142
     */
143
    static public void assertEquals(Object expected, Object actual) {
144 1 1. assertEquals : removed call to org/junit/Assert::assertEquals → KILLED
        assertEquals(null, expected, actual);
145
    }
146
147
    /**
148
     * Asserts that two objects are <b>not</b> equals. If they are, an
149
     * {@link AssertionError} is thrown with the given message. If
150
     * <code>unexpected</code> and <code>actual</code> are <code>null</code>,
151
     * they are considered equal.
152
     *
153
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
154
     * okay)
155
     * @param unexpected unexpected value to check
156
     * @param actual the value to check against <code>unexpected</code>
157
     */
158
    static public void assertNotEquals(String message, Object unexpected,
159
            Object actual) {
160 1 1. assertNotEquals : negated conditional → KILLED
        if (equalsRegardingNull(unexpected, actual)) {
161 1 1. assertNotEquals : removed call to org/junit/Assert::failEquals → KILLED
            failEquals(message, actual);
162
        }
163
    }
164
165
    /**
166
     * Asserts that two objects are <b>not</b> equals. If they are, an
167
     * {@link AssertionError} without a message is thrown. If
168
     * <code>unexpected</code> and <code>actual</code> are <code>null</code>,
169
     * they are considered equal.
170
     *
171
     * @param unexpected unexpected value to check
172
     * @param actual the value to check against <code>unexpected</code>
173
     */
174
    static public void assertNotEquals(Object unexpected, Object actual) {
175 1 1. assertNotEquals : removed call to org/junit/Assert::assertNotEquals → KILLED
        assertNotEquals(null, unexpected, actual);
176
    }
177
178
    private static void failEquals(String message, Object actual) {
179
        String formatted = "Values should be different. ";
180 1 1. failEquals : negated conditional → KILLED
        if (message != null) {
181
            formatted = message + ". ";
182
        }
183
184
        formatted += "Actual: " + actual;
185 1 1. failEquals : removed call to org/junit/Assert::fail → KILLED
        fail(formatted);
186
    }
187
188
    /**
189
     * Asserts that two longs are <b>not</b> equals. If they are, an
190
     * {@link AssertionError} is thrown with the given message.
191
     *
192
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
193
     * okay)
194
     * @param unexpected unexpected value to check
195
     * @param actual the value to check against <code>unexpected</code>
196
     */
197
    static public void assertNotEquals(String message, long unexpected, long actual) {
198 1 1. assertNotEquals : negated conditional → KILLED
        if (unexpected == actual) {
199 1 1. assertNotEquals : removed call to org/junit/Assert::failEquals → NO_COVERAGE
            failEquals(message, Long.valueOf(actual));
200
        }
201
    }
202
203
    /**
204
     * Asserts that two longs are <b>not</b> equals. If they are, an
205
     * {@link AssertionError} without a message is thrown.
206
     *
207
     * @param unexpected unexpected value to check
208
     * @param actual the value to check against <code>unexpected</code>
209
     */
210
    static public void assertNotEquals(long unexpected, long actual) {
211 1 1. assertNotEquals : removed call to org/junit/Assert::assertNotEquals → SURVIVED
        assertNotEquals(null, unexpected, actual);
212
    }
213
214
    /**
215
     * Asserts that two doubles are <b>not</b> equal to within a positive delta.
216
     * If they are, an {@link AssertionError} is thrown with the given
217
     * message. If the unexpected value is infinity then the delta value is
218
     * ignored. NaNs are considered equal:
219
     * <code>assertNotEquals(Double.NaN, Double.NaN, *)</code> fails
220
     *
221
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
222
     * okay)
223
     * @param unexpected unexpected value
224
     * @param actual the value to check against <code>unexpected</code>
225
     * @param delta the maximum delta between <code>unexpected</code> and
226
     * <code>actual</code> for which both numbers are still
227
     * considered equal.
228
     */
229
    static public void assertNotEquals(String message, double unexpected,
230
            double actual, double delta) {
231 1 1. assertNotEquals : negated conditional → KILLED
        if (!doubleIsDifferent(unexpected, actual, delta)) {
232 1 1. assertNotEquals : removed call to org/junit/Assert::failEquals → KILLED
            failEquals(message, Double.valueOf(actual));
233
        }
234
    }
235
236
    /**
237
     * Asserts that two doubles are <b>not</b> equal to within a positive delta.
238
     * If they are, an {@link AssertionError} is thrown. If the unexpected
239
     * value is infinity then the delta value is ignored.NaNs are considered
240
     * equal: <code>assertNotEquals(Double.NaN, Double.NaN, *)</code> fails
241
     *
242
     * @param unexpected unexpected value
243
     * @param actual the value to check against <code>unexpected</code>
244
     * @param delta the maximum delta between <code>unexpected</code> and
245
     * <code>actual</code> for which both numbers are still
246
     * considered equal.
247
     */
248
    static public void assertNotEquals(double unexpected, double actual, double delta) {
249 1 1. assertNotEquals : removed call to org/junit/Assert::assertNotEquals → KILLED
        assertNotEquals(null, unexpected, actual, delta);
250
    }
251
252
    /**
253
     * Asserts that two floats are <b>not</b> equal to within a positive delta.
254
     * If they are, an {@link AssertionError} is thrown. If the unexpected
255
     * value is infinity then the delta value is ignored.NaNs are considered
256
     * equal: <code>assertNotEquals(Float.NaN, Float.NaN, *)</code> fails
257
     *
258
     * @param unexpected unexpected value
259
     * @param actual the value to check against <code>unexpected</code>
260
     * @param delta the maximum delta between <code>unexpected</code> and
261
     * <code>actual</code> for which both numbers are still
262
     * considered equal.
263
     */
264
    static public void assertNotEquals(float unexpected, float actual, float delta) {
265 1 1. assertNotEquals : removed call to org/junit/Assert::assertNotEquals → KILLED
        assertNotEquals(null, unexpected, actual, delta);
266
    }
267
268
    /**
269
     * Asserts that two object arrays are equal. If they are not, an
270
     * {@link AssertionError} is thrown with the given message. If
271
     * <code>expecteds</code> and <code>actuals</code> are <code>null</code>,
272
     * they are considered equal.
273
     *
274
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
275
     * okay)
276
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
277
     * expected values.
278
     * @param actuals Object array or array of arrays (multi-dimensional array) with
279
     * actual values
280
     */
281
    public static void assertArrayEquals(String message, Object[] expecteds,
282
            Object[] actuals) throws ArrayComparisonFailure {
283 1 1. assertArrayEquals : removed call to org/junit/Assert::internalArrayEquals → KILLED
        internalArrayEquals(message, expecteds, actuals);
284
    }
285
286
    /**
287
     * Asserts that two object arrays are equal. If they are not, an
288
     * {@link AssertionError} is thrown. If <code>expected</code> and
289
     * <code>actual</code> are <code>null</code>, they are considered
290
     * equal.
291
     *
292
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
293
     * expected values
294
     * @param actuals Object array or array of arrays (multi-dimensional array) with
295
     * actual values
296
     */
297
    public static void assertArrayEquals(Object[] expecteds, Object[] actuals) {
298 1 1. assertArrayEquals : removed call to org/junit/Assert::assertArrayEquals → KILLED
        assertArrayEquals(null, expecteds, actuals);
299
    }
300
    
301
    /**
302
     * Asserts that two boolean arrays are equal. If they are not, an
303
     * {@link AssertionError} is thrown with the given message. If
304
     * <code>expecteds</code> and <code>actuals</code> are <code>null</code>,
305
     * they are considered equal.
306
     *
307
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
308
     * okay)
309
     * @param expecteds boolean array with expected values.
310
     * @param actuals boolean array with expected values.
311
     */
312
    public static void assertArrayEquals(String message, boolean[] expecteds,
313
            boolean[] actuals) throws ArrayComparisonFailure {
314 1 1. assertArrayEquals : removed call to org/junit/Assert::internalArrayEquals → KILLED
        internalArrayEquals(message, expecteds, actuals);
315
    }    
316
    
317
    /**
318
     * Asserts that two boolean arrays are equal. If they are not, an
319
     * {@link AssertionError} is thrown. If <code>expected</code> and
320
     * <code>actual</code> are <code>null</code>, they are considered
321
     * equal.
322
     *
323
     * @param expecteds boolean array with expected values.
324
     * @param actuals boolean array with expected values.
325
     */
326
    public static void assertArrayEquals(boolean[] expecteds, boolean[] actuals) {
327 1 1. assertArrayEquals : removed call to org/junit/Assert::assertArrayEquals → KILLED
        assertArrayEquals(null, expecteds, actuals);
328
    }
329
330
    /**
331
     * Asserts that two byte arrays are equal. If they are not, an
332
     * {@link AssertionError} is thrown with the given message.
333
     *
334
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
335
     * okay)
336
     * @param expecteds byte array with expected values.
337
     * @param actuals byte array with actual values
338
     */
339
    public static void assertArrayEquals(String message, byte[] expecteds,
340
            byte[] actuals) throws ArrayComparisonFailure {
341 1 1. assertArrayEquals : removed call to org/junit/Assert::internalArrayEquals → SURVIVED
        internalArrayEquals(message, expecteds, actuals);
342
    }
343
344
    /**
345
     * Asserts that two byte arrays are equal. If they are not, an
346
     * {@link AssertionError} is thrown.
347
     *
348
     * @param expecteds byte array with expected values.
349
     * @param actuals byte array with actual values
350
     */
351
    public static void assertArrayEquals(byte[] expecteds, byte[] actuals) {
352 1 1. assertArrayEquals : removed call to org/junit/Assert::assertArrayEquals → SURVIVED
        assertArrayEquals(null, expecteds, actuals);
353
    }
354
355
    /**
356
     * Asserts that two char arrays are equal. If they are not, an
357
     * {@link AssertionError} is thrown with the given message.
358
     *
359
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
360
     * okay)
361
     * @param expecteds char array with expected values.
362
     * @param actuals char array with actual values
363
     */
364
    public static void assertArrayEquals(String message, char[] expecteds,
365
            char[] actuals) throws ArrayComparisonFailure {
366 1 1. assertArrayEquals : removed call to org/junit/Assert::internalArrayEquals → SURVIVED
        internalArrayEquals(message, expecteds, actuals);
367
    }
368
369
    /**
370
     * Asserts that two char arrays are equal. If they are not, an
371
     * {@link AssertionError} is thrown.
372
     *
373
     * @param expecteds char array with expected values.
374
     * @param actuals char array with actual values
375
     */
376
    public static void assertArrayEquals(char[] expecteds, char[] actuals) {
377 1 1. assertArrayEquals : removed call to org/junit/Assert::assertArrayEquals → SURVIVED
        assertArrayEquals(null, expecteds, actuals);
378
    }
379
380
    /**
381
     * Asserts that two short arrays are equal. If they are not, an
382
     * {@link AssertionError} is thrown with the given message.
383
     *
384
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
385
     * okay)
386
     * @param expecteds short array with expected values.
387
     * @param actuals short array with actual values
388
     */
389
    public static void assertArrayEquals(String message, short[] expecteds,
390
            short[] actuals) throws ArrayComparisonFailure {
391 1 1. assertArrayEquals : removed call to org/junit/Assert::internalArrayEquals → SURVIVED
        internalArrayEquals(message, expecteds, actuals);
392
    }
393
394
    /**
395
     * Asserts that two short arrays are equal. If they are not, an
396
     * {@link AssertionError} is thrown.
397
     *
398
     * @param expecteds short array with expected values.
399
     * @param actuals short array with actual values
400
     */
401
    public static void assertArrayEquals(short[] expecteds, short[] actuals) {
402 1 1. assertArrayEquals : removed call to org/junit/Assert::assertArrayEquals → SURVIVED
        assertArrayEquals(null, expecteds, actuals);
403
    }
404
405
    /**
406
     * Asserts that two int arrays are equal. If they are not, an
407
     * {@link AssertionError} is thrown with the given message.
408
     *
409
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
410
     * okay)
411
     * @param expecteds int array with expected values.
412
     * @param actuals int array with actual values
413
     */
414
    public static void assertArrayEquals(String message, int[] expecteds,
415
            int[] actuals) throws ArrayComparisonFailure {
416 1 1. assertArrayEquals : removed call to org/junit/Assert::internalArrayEquals → SURVIVED
        internalArrayEquals(message, expecteds, actuals);
417
    }
418
419
    /**
420
     * Asserts that two int arrays are equal. If they are not, an
421
     * {@link AssertionError} is thrown.
422
     *
423
     * @param expecteds int array with expected values.
424
     * @param actuals int array with actual values
425
     */
426
    public static void assertArrayEquals(int[] expecteds, int[] actuals) {
427 1 1. assertArrayEquals : removed call to org/junit/Assert::assertArrayEquals → SURVIVED
        assertArrayEquals(null, expecteds, actuals);
428
    }
429
430
    /**
431
     * Asserts that two long arrays are equal. If they are not, an
432
     * {@link AssertionError} is thrown with the given message.
433
     *
434
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
435
     * okay)
436
     * @param expecteds long array with expected values.
437
     * @param actuals long array with actual values
438
     */
439
    public static void assertArrayEquals(String message, long[] expecteds,
440
            long[] actuals) throws ArrayComparisonFailure {
441 1 1. assertArrayEquals : removed call to org/junit/Assert::internalArrayEquals → SURVIVED
        internalArrayEquals(message, expecteds, actuals);
442
    }
443
444
    /**
445
     * Asserts that two long arrays are equal. If they are not, an
446
     * {@link AssertionError} is thrown.
447
     *
448
     * @param expecteds long array with expected values.
449
     * @param actuals long array with actual values
450
     */
451
    public static void assertArrayEquals(long[] expecteds, long[] actuals) {
452 1 1. assertArrayEquals : removed call to org/junit/Assert::assertArrayEquals → SURVIVED
        assertArrayEquals(null, expecteds, actuals);
453
    }
454
455
    /**
456
     * Asserts that two double arrays are equal. If they are not, an
457
     * {@link AssertionError} is thrown with the given message.
458
     *
459
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
460
     * okay)
461
     * @param expecteds double array with expected values.
462
     * @param actuals double array with actual values
463
     * @param delta the maximum delta between <code>expecteds[i]</code> and
464
     * <code>actuals[i]</code> for which both numbers are still
465
     * considered equal.
466
     */
467
    public static void assertArrayEquals(String message, double[] expecteds,
468
            double[] actuals, double delta) throws ArrayComparisonFailure {
469 1 1. assertArrayEquals : removed call to org/junit/internal/InexactComparisonCriteria::arrayEquals → KILLED
        new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals);
470
    }
471
472
    /**
473
     * Asserts that two double arrays are equal. If they are not, an
474
     * {@link AssertionError} is thrown.
475
     *
476
     * @param expecteds double array with expected values.
477
     * @param actuals double array with actual values
478
     * @param delta the maximum delta between <code>expecteds[i]</code> and
479
     * <code>actuals[i]</code> for which both numbers are still
480
     * considered equal.
481
     */
482
    public static void assertArrayEquals(double[] expecteds, double[] actuals, double delta) {
483 1 1. assertArrayEquals : removed call to org/junit/Assert::assertArrayEquals → KILLED
        assertArrayEquals(null, expecteds, actuals, delta);
484
    }
485
486
    /**
487
     * Asserts that two float arrays are equal. If they are not, an
488
     * {@link AssertionError} is thrown with the given message.
489
     *
490
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
491
     * okay)
492
     * @param expecteds float array with expected values.
493
     * @param actuals float array with actual values
494
     * @param delta the maximum delta between <code>expecteds[i]</code> and
495
     * <code>actuals[i]</code> for which both numbers are still
496
     * considered equal.
497
     */
498
    public static void assertArrayEquals(String message, float[] expecteds,
499
            float[] actuals, float delta) throws ArrayComparisonFailure {
500 1 1. assertArrayEquals : removed call to org/junit/internal/InexactComparisonCriteria::arrayEquals → KILLED
        new InexactComparisonCriteria(delta).arrayEquals(message, expecteds, actuals);
501
    }
502
503
    /**
504
     * Asserts that two float arrays are equal. If they are not, an
505
     * {@link AssertionError} is thrown.
506
     *
507
     * @param expecteds float array with expected values.
508
     * @param actuals float array with actual values
509
     * @param delta the maximum delta between <code>expecteds[i]</code> and
510
     * <code>actuals[i]</code> for which both numbers are still
511
     * considered equal.
512
     */
513
    public static void assertArrayEquals(float[] expecteds, float[] actuals, float delta) {
514 1 1. assertArrayEquals : removed call to org/junit/Assert::assertArrayEquals → KILLED
        assertArrayEquals(null, expecteds, actuals, delta);
515
    }
516
517
    /**
518
     * Asserts that two object arrays are equal. If they are not, an
519
     * {@link AssertionError} is thrown with the given message. If
520
     * <code>expecteds</code> and <code>actuals</code> are <code>null</code>,
521
     * they are considered equal.
522
     *
523
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
524
     * okay)
525
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
526
     * expected values.
527
     * @param actuals Object array or array of arrays (multi-dimensional array) with
528
     * actual values
529
     */
530
    private static void internalArrayEquals(String message, Object expecteds,
531
            Object actuals) throws ArrayComparisonFailure {
532 1 1. internalArrayEquals : removed call to org/junit/internal/ExactComparisonCriteria::arrayEquals → KILLED
        new ExactComparisonCriteria().arrayEquals(message, expecteds, actuals);
533
    }
534
535
    /**
536
     * Asserts that two doubles are equal to within a positive delta.
537
     * If they are not, an {@link AssertionError} is thrown with the given
538
     * message. If the expected value is infinity then the delta value is
539
     * ignored. NaNs are considered equal:
540
     * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes
541
     *
542
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
543
     * okay)
544
     * @param expected expected value
545
     * @param actual the value to check against <code>expected</code>
546
     * @param delta the maximum delta between <code>expected</code> and
547
     * <code>actual</code> for which both numbers are still
548
     * considered equal.
549
     */
550
    static public void assertEquals(String message, double expected,
551
            double actual, double delta) {
552 1 1. assertEquals : negated conditional → KILLED
        if (doubleIsDifferent(expected, actual, delta)) {
553 1 1. assertEquals : removed call to org/junit/Assert::failNotEquals → KILLED
            failNotEquals(message, Double.valueOf(expected), Double.valueOf(actual));
554
        }
555
    }
556
557
    /**
558
     * Asserts that two floats are equal to within a positive delta.
559
     * If they are not, an {@link AssertionError} is thrown with the given
560
     * message. If the expected value is infinity then the delta value is
561
     * ignored. NaNs are considered equal:
562
     * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes
563
     *
564
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
565
     * okay)
566
     * @param expected expected value
567
     * @param actual the value to check against <code>expected</code>
568
     * @param delta the maximum delta between <code>expected</code> and
569
     * <code>actual</code> for which both numbers are still
570
     * considered equal.
571
     */
572
    static public void assertEquals(String message, float expected,
573
            float actual, float delta) {
574 1 1. assertEquals : negated conditional → KILLED
        if (floatIsDifferent(expected, actual, delta)) {
575 1 1. assertEquals : removed call to org/junit/Assert::failNotEquals → KILLED
            failNotEquals(message, Float.valueOf(expected), Float.valueOf(actual));
576
        }
577
    }
578
579
    /**
580
     * Asserts that two floats are <b>not</b> equal to within a positive delta.
581
     * If they are, an {@link AssertionError} is thrown with the given
582
     * message. If the unexpected value is infinity then the delta value is
583
     * ignored. NaNs are considered equal:
584
     * <code>assertNotEquals(Float.NaN, Float.NaN, *)</code> fails
585
     *
586
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
587
     * okay)
588
     * @param unexpected unexpected value
589
     * @param actual the value to check against <code>unexpected</code>
590
     * @param delta the maximum delta between <code>unexpected</code> and
591
     * <code>actual</code> for which both numbers are still
592
     * considered equal.
593
     */
594
    static public void assertNotEquals(String message, float unexpected,
595
            float actual, float delta) {
596 1 1. assertNotEquals : negated conditional → KILLED
        if (!floatIsDifferent(unexpected, actual, delta)) {
597 1 1. assertNotEquals : removed call to org/junit/Assert::failEquals → KILLED
            failEquals(message, Float.valueOf(actual));
598
        }
599
    }
600
601
    static private boolean doubleIsDifferent(double d1, double d2, double delta) {
602 1 1. doubleIsDifferent : negated conditional → KILLED
        if (Double.compare(d1, d2) == 0) {
603 1 1. doubleIsDifferent : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
            return false;
604
        }
605 3 1. doubleIsDifferent : changed conditional boundary → SURVIVED
2. doubleIsDifferent : Replaced double subtraction with addition → KILLED
3. doubleIsDifferent : negated conditional → KILLED
        if ((Math.abs(d1 - d2) <= delta)) {
606 1 1. doubleIsDifferent : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
            return false;
607
        }
608
609 1 1. doubleIsDifferent : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return true;
610
    }
611
612
    static private boolean floatIsDifferent(float f1, float f2, float delta) {
613 1 1. floatIsDifferent : negated conditional → KILLED
        if (Float.compare(f1, f2) == 0) {
614 1 1. floatIsDifferent : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
            return false;
615
        }
616 3 1. floatIsDifferent : changed conditional boundary → KILLED
2. floatIsDifferent : Replaced float subtraction with addition → KILLED
3. floatIsDifferent : negated conditional → KILLED
        if ((Math.abs(f1 - f2) <= delta)) {
617 1 1. floatIsDifferent : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
            return false;
618
        }
619
620 1 1. floatIsDifferent : replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED
        return true;
621
    }
622
623
    /**
624
     * Asserts that two longs are equal. If they are not, an
625
     * {@link AssertionError} is thrown.
626
     *
627
     * @param expected expected long value.
628
     * @param actual actual long value
629
     */
630
    static public void assertEquals(long expected, long actual) {
631 1 1. assertEquals : removed call to org/junit/Assert::assertEquals → KILLED
        assertEquals(null, expected, actual);
632
    }
633
634
    /**
635
     * Asserts that two longs are equal. If they are not, an
636
     * {@link AssertionError} is thrown with the given message.
637
     *
638
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
639
     * okay)
640
     * @param expected long expected value.
641
     * @param actual long actual value
642
     */
643
    static public void assertEquals(String message, long expected, long actual) {
644 1 1. assertEquals : negated conditional → KILLED
        if (expected != actual) {
645 1 1. assertEquals : removed call to org/junit/Assert::failNotEquals → KILLED
            failNotEquals(message, Long.valueOf(expected), Long.valueOf(actual));
646
        }
647
    }
648
649
    /**
650
     * @deprecated Use
651
     *             <code>assertEquals(double expected, double actual, double delta)</code>
652
     *             instead
653
     */
654
    @Deprecated
655
    static public void assertEquals(double expected, double actual) {
656 1 1. assertEquals : removed call to org/junit/Assert::assertEquals → KILLED
        assertEquals(null, expected, actual);
657
    }
658
659
    /**
660
     * @deprecated Use
661
     *             <code>assertEquals(String message, double expected, double actual, double delta)</code>
662
     *             instead
663
     */
664
    @Deprecated
665
    static public void assertEquals(String message, double expected,
666
            double actual) {
667 1 1. assertEquals : removed call to org/junit/Assert::fail → KILLED
        fail("Use assertEquals(expected, actual, delta) to compare floating-point numbers");
668
    }
669
670
    /**
671
     * Asserts that two doubles are equal to within a positive delta.
672
     * If they are not, an {@link AssertionError} is thrown. If the expected
673
     * value is infinity then the delta value is ignored.NaNs are considered
674
     * equal: <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes
675
     *
676
     * @param expected expected value
677
     * @param actual the value to check against <code>expected</code>
678
     * @param delta the maximum delta between <code>expected</code> and
679
     * <code>actual</code> for which both numbers are still
680
     * considered equal.
681
     */
682
    static public void assertEquals(double expected, double actual, double delta) {
683 1 1. assertEquals : removed call to org/junit/Assert::assertEquals → KILLED
        assertEquals(null, expected, actual, delta);
684
    }
685
686
    /**
687
     * Asserts that two floats are equal to within a positive delta.
688
     * If they are not, an {@link AssertionError} is thrown. If the expected
689
     * value is infinity then the delta value is ignored. NaNs are considered
690
     * equal: <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes
691
     *
692
     * @param expected expected value
693
     * @param actual the value to check against <code>expected</code>
694
     * @param delta the maximum delta between <code>expected</code> and
695
     * <code>actual</code> for which both numbers are still
696
     * considered equal.
697
     */
698
699
    static public void assertEquals(float expected, float actual, float delta) {
700 1 1. assertEquals : removed call to org/junit/Assert::assertEquals → KILLED
        assertEquals(null, expected, actual, delta);
701
    }
702
703
    /**
704
     * Asserts that an object isn't null. If it is an {@link AssertionError} is
705
     * thrown with the given message.
706
     *
707
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
708
     * okay)
709
     * @param object Object to check or <code>null</code>
710
     */
711
    static public void assertNotNull(String message, Object object) {
712 2 1. assertNotNull : negated conditional → NO_COVERAGE
2. assertNotNull : removed call to org/junit/Assert::assertTrue → NO_COVERAGE
        assertTrue(message, object != null);
713
    }
714
715
    /**
716
     * Asserts that an object isn't null. If it is an {@link AssertionError} is
717
     * thrown.
718
     *
719
     * @param object Object to check or <code>null</code>
720
     */
721
    static public void assertNotNull(Object object) {
722 1 1. assertNotNull : removed call to org/junit/Assert::assertNotNull → NO_COVERAGE
        assertNotNull(null, object);
723
    }
724
725
    /**
726
     * Asserts that an object is null. If it is not, an {@link AssertionError}
727
     * is thrown with the given message.
728
     *
729
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
730
     * okay)
731
     * @param object Object to check or <code>null</code>
732
     */
733
    static public void assertNull(String message, Object object) {
734 1 1. assertNull : negated conditional → KILLED
        if (object == null) {
735
            return;
736
        }
737 1 1. assertNull : removed call to org/junit/Assert::failNotNull → KILLED
        failNotNull(message, object);
738
    }
739
740
    /**
741
     * Asserts that an object is null. If it isn't an {@link AssertionError} is
742
     * thrown.
743
     *
744
     * @param object Object to check or <code>null</code>
745
     */
746
    static public void assertNull(Object object) {
747 1 1. assertNull : removed call to org/junit/Assert::assertNull → KILLED
        assertNull(null, object);
748
    }
749
750
    static private void failNotNull(String message, Object actual) {
751
        String formatted = "";
752 1 1. failNotNull : negated conditional → KILLED
        if (message != null) {
753
            formatted = message + " ";
754
        }
755 1 1. failNotNull : removed call to org/junit/Assert::fail → KILLED
        fail(formatted + "expected null, but was:<" + actual + ">");
756
    }
757
758
    /**
759
     * Asserts that two objects refer to the same object. If they are not, an
760
     * {@link AssertionError} is thrown with the given message.
761
     *
762
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
763
     * okay)
764
     * @param expected the expected object
765
     * @param actual the object to compare to <code>expected</code>
766
     */
767
    static public void assertSame(String message, Object expected, Object actual) {
768 1 1. assertSame : negated conditional → KILLED
        if (expected == actual) {
769
            return;
770
        }
771 1 1. assertSame : removed call to org/junit/Assert::failNotSame → KILLED
        failNotSame(message, expected, actual);
772
    }
773
774
    /**
775
     * Asserts that two objects refer to the same object. If they are not the
776
     * same, an {@link AssertionError} without a message is thrown.
777
     *
778
     * @param expected the expected object
779
     * @param actual the object to compare to <code>expected</code>
780
     */
781
    static public void assertSame(Object expected, Object actual) {
782 1 1. assertSame : removed call to org/junit/Assert::assertSame → KILLED
        assertSame(null, expected, actual);
783
    }
784
785
    /**
786
     * Asserts that two objects do not refer to the same object. If they do
787
     * refer to the same object, an {@link AssertionError} is thrown with the
788
     * given message.
789
     *
790
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
791
     * okay)
792
     * @param unexpected the object you don't expect
793
     * @param actual the object to compare to <code>unexpected</code>
794
     */
795
    static public void assertNotSame(String message, Object unexpected,
796
            Object actual) {
797 1 1. assertNotSame : negated conditional → KILLED
        if (unexpected == actual) {
798 1 1. assertNotSame : removed call to org/junit/Assert::failSame → KILLED
            failSame(message);
799
        }
800
    }
801
802
    /**
803
     * Asserts that two objects do not refer to the same object. If they do
804
     * refer to the same object, an {@link AssertionError} without a message is
805
     * thrown.
806
     *
807
     * @param unexpected the object you don't expect
808
     * @param actual the object to compare to <code>unexpected</code>
809
     */
810
    static public void assertNotSame(Object unexpected, Object actual) {
811 1 1. assertNotSame : removed call to org/junit/Assert::assertNotSame → KILLED
        assertNotSame(null, unexpected, actual);
812
    }
813
814
    static private void failSame(String message) {
815
        String formatted = "";
816 1 1. failSame : negated conditional → KILLED
        if (message != null) {
817
            formatted = message + " ";
818
        }
819 1 1. failSame : removed call to org/junit/Assert::fail → KILLED
        fail(formatted + "expected not same");
820
    }
821
822
    static private void failNotSame(String message, Object expected,
823
            Object actual) {
824
        String formatted = "";
825 1 1. failNotSame : negated conditional → KILLED
        if (message != null) {
826
            formatted = message + " ";
827
        }
828 1 1. failNotSame : removed call to org/junit/Assert::fail → KILLED
        fail(formatted + "expected same:<" + expected + "> was not:<" + actual
829
                + ">");
830
    }
831
832
    static private void failNotEquals(String message, Object expected,
833
            Object actual) {
834 1 1. failNotEquals : removed call to org/junit/Assert::fail → KILLED
        fail(format(message, expected, actual));
835
    }
836
837
    static String format(String message, Object expected, Object actual) {
838
        String formatted = "";
839 2 1. format : negated conditional → KILLED
2. format : negated conditional → KILLED
        if (message != null && !message.equals("")) {
840
            formatted = message + " ";
841
        }
842
        String expectedString = String.valueOf(expected);
843
        String actualString = String.valueOf(actual);
844 1 1. format : negated conditional → KILLED
        if (expectedString.equals(actualString)) {
845 1 1. format : mutated return of Object value for org/junit/Assert::format to ( if (x != null) null else throw new RuntimeException ) → KILLED
            return formatted + "expected: "
846
                    + formatClassAndValue(expected, expectedString)
847
                    + " but was: " + formatClassAndValue(actual, actualString);
848
        } else {
849 1 1. format : mutated return of Object value for org/junit/Assert::format to ( if (x != null) null else throw new RuntimeException ) → KILLED
            return formatted + "expected:<" + expectedString + "> but was:<"
850
                    + actualString + ">";
851
        }
852
    }
853
854
    private static String formatClassAndValue(Object value, String valueString) {
855 1 1. formatClassAndValue : negated conditional → KILLED
        String className = value == null ? "null" : value.getClass().getName();
856 1 1. formatClassAndValue : mutated return of Object value for org/junit/Assert::formatClassAndValue to ( if (x != null) null else throw new RuntimeException ) → KILLED
        return className + "<" + valueString + ">";
857
    }
858
859
    /**
860
     * Asserts that two object arrays are equal. If they are not, an
861
     * {@link AssertionError} is thrown with the given message. If
862
     * <code>expecteds</code> and <code>actuals</code> are <code>null</code>,
863
     * they are considered equal.
864
     *
865
     * @param message the identifying message for the {@link AssertionError} (<code>null</code>
866
     * okay)
867
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
868
     * expected values.
869
     * @param actuals Object array or array of arrays (multi-dimensional array) with
870
     * actual values
871
     * @deprecated use assertArrayEquals
872
     */
873
    @Deprecated
874
    public static void assertEquals(String message, Object[] expecteds,
875
            Object[] actuals) {
876 1 1. assertEquals : removed call to org/junit/Assert::assertArrayEquals → NO_COVERAGE
        assertArrayEquals(message, expecteds, actuals);
877
    }
878
879
    /**
880
     * Asserts that two object arrays are equal. If they are not, an
881
     * {@link AssertionError} is thrown. If <code>expected</code> and
882
     * <code>actual</code> are <code>null</code>, they are considered
883
     * equal.
884
     *
885
     * @param expecteds Object array or array of arrays (multi-dimensional array) with
886
     * expected values
887
     * @param actuals Object array or array of arrays (multi-dimensional array) with
888
     * actual values
889
     * @deprecated use assertArrayEquals
890
     */
891
    @Deprecated
892
    public static void assertEquals(Object[] expecteds, Object[] actuals) {
893 1 1. assertEquals : removed call to org/junit/Assert::assertArrayEquals → NO_COVERAGE
        assertArrayEquals(expecteds, actuals);
894
    }
895
896
    /**
897
     * Asserts that <code>actual</code> satisfies the condition specified by
898
     * <code>matcher</code>. If not, an {@link AssertionError} is thrown with
899
     * information about the matcher and failing value. Example:
900
     *
901
     * <pre>
902
     *   assertThat(0, is(1)); // fails:
903
     *     // failure message:
904
     *     // expected: is &lt;1&gt;
905
     *     // got value: &lt;0&gt;
906
     *   assertThat(0, is(not(1))) // passes
907
     * </pre>
908
     *
909
     * <code>org.hamcrest.Matcher</code> does not currently document the meaning
910
     * of its type parameter <code>T</code>.  This method assumes that a matcher
911
     * typed as <code>Matcher&lt;T&gt;</code> can be meaningfully applied only
912
     * to values that could be assigned to a variable of type <code>T</code>.
913
     *
914
     * @param <T> the static type accepted by the matcher (this can flag obvious
915
     * compile-time problems such as {@code assertThat(1, is("a"))}
916
     * @param actual the computed value being compared
917
     * @param matcher an expression, built of {@link Matcher}s, specifying allowed
918
     * values
919
     * @see org.hamcrest.CoreMatchers
920
     * @see org.hamcrest.MatcherAssert
921
     */
922
    public static <T> void assertThat(T actual, Matcher<? super T> matcher) {
923 1 1. assertThat : removed call to org/junit/Assert::assertThat → SURVIVED
        assertThat("", actual, matcher);
924
    }
925
926
    /**
927
     * Asserts that <code>actual</code> satisfies the condition specified by
928
     * <code>matcher</code>. If not, an {@link AssertionError} is thrown with
929
     * the reason and information about the matcher and failing value. Example:
930
     *
931
     * <pre>
932
     *   assertThat(&quot;Help! Integers don't work&quot;, 0, is(1)); // fails:
933
     *     // failure message:
934
     *     // Help! Integers don't work
935
     *     // expected: is &lt;1&gt;
936
     *     // got value: &lt;0&gt;
937
     *   assertThat(&quot;Zero is one&quot;, 0, is(not(1))) // passes
938
     * </pre>
939
     *
940
     * <code>org.hamcrest.Matcher</code> does not currently document the meaning
941
     * of its type parameter <code>T</code>.  This method assumes that a matcher
942
     * typed as <code>Matcher&lt;T&gt;</code> can be meaningfully applied only
943
     * to values that could be assigned to a variable of type <code>T</code>.
944
     *
945
     * @param reason additional information about the error
946
     * @param <T> the static type accepted by the matcher (this can flag obvious
947
     * compile-time problems such as {@code assertThat(1, is("a"))}
948
     * @param actual the computed value being compared
949
     * @param matcher an expression, built of {@link Matcher}s, specifying allowed
950
     * values
951
     * @see org.hamcrest.CoreMatchers
952
     * @see org.hamcrest.MatcherAssert
953
     */
954
    public static <T> void assertThat(String reason, T actual,
955
            Matcher<? super T> matcher) {
956 1 1. assertThat : removed call to org/hamcrest/MatcherAssert::assertThat → SURVIVED
        MatcherAssert.assertThat(reason, actual, matcher);
957
    }
958
}

Mutations

40

1.1
Location : assertTrue
Killed by : org.junit.tests.assertion.MultipleFailureExceptionTest.assertEmptyThrowsMutipleFailureExceptionForManyThrowables(org.junit.tests.assertion.MultipleFailureExceptionTest)
negated conditional → KILLED

41

1.1
Location : assertTrue
Killed by : none
removed call to org/junit/Assert::fail → NO_COVERAGE

52

1.1
Location : assertTrue
Killed by : none
removed call to org/junit/Assert::assertTrue → SURVIVED

64

1.1
Location : assertFalse
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : assertFalse
Killed by : none
removed call to org/junit/Assert::assertTrue → NO_COVERAGE

74

1.1
Location : assertFalse
Killed by : none
removed call to org/junit/Assert::assertFalse → NO_COVERAGE

85

1.1
Location : fail
Killed by : org.junit.tests.assertion.AssertionTest.multiDimensionalArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

95

1.1
Location : fail
Killed by : org.junit.tests.assertion.AssertionTest.fails(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::fail → KILLED

111

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.stringsNotEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

113

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.stringsNotEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

2.2
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.stringsNotEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

114

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.stringsDifferWithUserMessage(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

118

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.notEqualsNullWithObject(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failNotEquals → KILLED

123

1.1
Location : equalsRegardingNull
Killed by : org.junit.tests.assertion.AssertionTest.multiDimensionalArraysAreEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

124

1.1
Location : equalsRegardingNull
Killed by : org.junit.tests.assertion.AssertionTest.notEqualsNullWithObject(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

2.2
Location : equalsRegardingNull
Killed by : org.junit.tests.assertion.AssertionTest.arraysWithNullElementEqual(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

3.3
Location : equalsRegardingNull
Killed by : org.junit.tests.assertion.AssertionTest.notEqualsNullWithObject(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

127

1.1
Location : equalsRegardingNull
Killed by : org.junit.tests.assertion.AssertionTest.stringsNotEqual(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

131

1.1
Location : isEquals
Killed by : org.junit.tests.assertion.AssertionTest.stringsNotEqual(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

144

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.stringsNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertEquals → KILLED

160

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.objectsWithDiferentReferencesAreNotEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

161

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.sameObjectIsNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failEquals → KILLED

175

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.sameObjectIsNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertNotEquals → KILLED

180

1.1
Location : failEquals
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsIncludesCorrectMessage(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

185

1.1
Location : failEquals
Killed by : org.junit.tests.assertion.AssertionTest.sameObjectIsNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::fail → KILLED

198

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsWorksWithPrimitiveTypes(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

199

1.1
Location : assertNotEquals
Killed by : none
removed call to org/junit/Assert::failEquals → NO_COVERAGE

211

1.1
Location : assertNotEquals
Killed by : none
removed call to org/junit/Assert::assertNotEquals → SURVIVED

231

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsIgnoresDeltaOnNaN(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

232

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsIgnoresDeltaOnNaN(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failEquals → KILLED

249

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsIgnoresDeltaOnNaN(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertNotEquals → KILLED

265

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsIgnoresFloatDeltaOnNaN(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertNotEquals → KILLED

283

1.1
Location : assertArrayEquals
Killed by : org.junit.tests.assertion.AssertionTest.multiDimensionalArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::internalArrayEquals → KILLED

298

1.1
Location : assertArrayEquals
Killed by : org.junit.tests.assertion.AssertionTest.multiDimensionalArraysAreNotEqualNoMessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertArrayEquals → KILLED

314

1.1
Location : assertArrayEquals
Killed by : org.junit.tests.assertion.AssertionTest.oneDimensionalBooleanArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::internalArrayEquals → KILLED

327

1.1
Location : assertArrayEquals
Killed by : org.junit.tests.assertion.AssertionTest.oneDimensionalBooleanArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertArrayEquals → KILLED

341

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::internalArrayEquals → SURVIVED

352

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::assertArrayEquals → SURVIVED

366

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::internalArrayEquals → SURVIVED

377

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::assertArrayEquals → SURVIVED

391

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::internalArrayEquals → SURVIVED

402

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::assertArrayEquals → SURVIVED

416

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::internalArrayEquals → SURVIVED

427

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::assertArrayEquals → SURVIVED

441

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::internalArrayEquals → SURVIVED

452

1.1
Location : assertArrayEquals
Killed by : none
removed call to org/junit/Assert::assertArrayEquals → SURVIVED

469

1.1
Location : assertArrayEquals
Killed by : org.junit.tests.assertion.AssertionTest.oneDimensionalDoubleArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/internal/InexactComparisonCriteria::arrayEquals → KILLED

483

1.1
Location : assertArrayEquals
Killed by : org.junit.tests.assertion.AssertionTest.oneDimensionalDoubleArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertArrayEquals → KILLED

500

1.1
Location : assertArrayEquals
Killed by : org.junit.tests.assertion.AssertionTest.oneDimensionalFloatArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/internal/InexactComparisonCriteria::arrayEquals → KILLED

514

1.1
Location : assertArrayEquals
Killed by : org.junit.tests.assertion.AssertionTest.oneDimensionalFloatArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertArrayEquals → KILLED

532

1.1
Location : internalArrayEquals
Killed by : org.junit.tests.assertion.AssertionTest.multiDimensionalArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/internal/ExactComparisonCriteria::arrayEquals → KILLED

552

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.naNsAreEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

553

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failNotEquals → KILLED

574

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.naNsAreEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

575

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.oneDimensionalFloatArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failNotEquals → KILLED

596

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsIgnoresFloatDeltaOnNaN(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

597

1.1
Location : assertNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsIgnoresFloatDeltaOnNaN(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failEquals → KILLED

602

1.1
Location : doubleIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.naNsAreEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

603

1.1
Location : doubleIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.naNsAreEqual(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

605

1.1
Location : doubleIsDifferent
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : doubleIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsConsidersDeltaCorrectly(org.junit.tests.assertion.AssertionTest)
Replaced double subtraction with addition → KILLED

3.3
Location : doubleIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

606

1.1
Location : doubleIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.assertNotEqualsConsidersDeltaCorrectly(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

609

1.1
Location : doubleIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotEqual(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

613

1.1
Location : floatIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.naNsAreEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

614

1.1
Location : floatIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.naNsAreEqual(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

616

1.1
Location : floatIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotDoublesInArrays(org.junit.tests.assertion.AssertionTest)
changed conditional boundary → KILLED

2.2
Location : floatIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotDoublesInArrays(org.junit.tests.assertion.AssertionTest)
Replaced float subtraction with addition → KILLED

3.3
Location : floatIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotDoublesInArrays(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

617

1.1
Location : floatIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotDoublesInArrays(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

620

1.1
Location : floatIsDifferent
Killed by : org.junit.tests.assertion.AssertionTest.oneDimensionalFloatArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
replaced return of integer sized value with (x == 0 ? 1 : 0) → KILLED

631

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.longsNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertEquals → KILLED

644

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.MultipleFailureExceptionTest.assertEmptyRethrowsSingleError(org.junit.tests.assertion.MultipleFailureExceptionTest)
negated conditional → KILLED

645

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.longsNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failNotEquals → KILLED

656

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotEqualWithoutDelta(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertEquals → KILLED

667

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotEqualWithoutDelta(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::fail → KILLED

683

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.floatsNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertEquals → KILLED

700

1.1
Location : assertEquals
Killed by : org.junit.tests.assertion.AssertionTest.oneDimensionalFloatArraysAreNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertEquals → KILLED

712

1.1
Location : assertNotNull
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : assertNotNull
Killed by : none
removed call to org/junit/Assert::assertTrue → NO_COVERAGE

722

1.1
Location : assertNotNull
Killed by : none
removed call to org/junit/Assert::assertNotNull → NO_COVERAGE

734

1.1
Location : assertNull
Killed by : org.junit.tests.assertion.AssertionTest.nullMessage(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

737

1.1
Location : assertNull
Killed by : org.junit.tests.assertion.AssertionTest.nullNullmessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failNotNull → KILLED

747

1.1
Location : assertNull
Killed by : org.junit.tests.assertion.AssertionTest.nullNullmessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertNull → KILLED

752

1.1
Location : failNotNull
Killed by : org.junit.tests.assertion.AssertionTest.nullNullmessage(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

755

1.1
Location : failNotNull
Killed by : org.junit.tests.assertion.AssertionTest.nullNullmessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::fail → KILLED

768

1.1
Location : assertSame
Killed by : org.junit.tests.assertion.MultipleFailureExceptionTest.assertEmptyRethrowsSingleError(org.junit.tests.assertion.MultipleFailureExceptionTest)
negated conditional → KILLED

771

1.1
Location : assertSame
Killed by : org.junit.tests.assertion.AssertionTest.sameNullMessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failNotSame → KILLED

782

1.1
Location : assertSame
Killed by : org.junit.tests.assertion.AssertionTest.sameNullMessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertSame → KILLED

797

1.1
Location : assertNotSame
Killed by : org.junit.tests.assertion.AssertionTest.notSameWithMessage(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

798

1.1
Location : assertNotSame
Killed by : org.junit.tests.assertion.AssertionTest.notSameWithMessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::failSame → KILLED

811

1.1
Location : assertNotSame
Killed by : org.junit.tests.assertion.AssertionTest.notSameNullMessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::assertNotSame → KILLED

816

1.1
Location : failSame
Killed by : org.junit.tests.assertion.AssertionTest.notSameWithMessage(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

819

1.1
Location : failSame
Killed by : org.junit.tests.assertion.AssertionTest.notSameWithMessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::fail → KILLED

825

1.1
Location : failNotSame
Killed by : org.junit.tests.assertion.AssertionTest.sameNullMessage(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

828

1.1
Location : failNotSame
Killed by : org.junit.tests.assertion.AssertionTest.sameNullMessage(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::fail → KILLED

834

1.1
Location : failNotEquals
Killed by : org.junit.tests.assertion.AssertionTest.longsNotEqual(org.junit.tests.assertion.AssertionTest)
removed call to org/junit/Assert::fail → KILLED

839

1.1
Location : format
Killed by : org.junit.tests.assertion.AssertionTest.longsNotEqual(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

2.2
Location : format
Killed by : org.junit.tests.assertion.ComparisonFailureTest.compactFailureMessage[compact-msg-1, exp="bc"](org.junit.tests.assertion.ComparisonFailureTest)
negated conditional → KILLED

844

1.1
Location : format
Killed by : org.junit.tests.assertion.ComparisonFailureTest.compactFailureMessage[compact-msg-1, exp="bc"](org.junit.tests.assertion.ComparisonFailureTest)
negated conditional → KILLED

845

1.1
Location : format
Killed by : org.junit.tests.assertion.AssertionTest.nullAndStringNullPrintCorrectError(org.junit.tests.assertion.AssertionTest)
mutated return of Object value for org/junit/Assert::format to ( if (x != null) null else throw new RuntimeException ) → KILLED

849

1.1
Location : format
Killed by : org.junit.tests.assertion.ComparisonFailureTest.compactFailureMessage[compact-msg-1, exp="bc"](org.junit.tests.assertion.ComparisonFailureTest)
mutated return of Object value for org/junit/Assert::format to ( if (x != null) null else throw new RuntimeException ) → KILLED

855

1.1
Location : formatClassAndValue
Killed by : org.junit.tests.assertion.AssertionTest.nullAndStringNullPrintCorrectError(org.junit.tests.assertion.AssertionTest)
negated conditional → KILLED

856

1.1
Location : formatClassAndValue
Killed by : org.junit.tests.assertion.AssertionTest.nullAndStringNullPrintCorrectError(org.junit.tests.assertion.AssertionTest)
mutated return of Object value for org/junit/Assert::formatClassAndValue to ( if (x != null) null else throw new RuntimeException ) → KILLED

876

1.1
Location : assertEquals
Killed by : none
removed call to org/junit/Assert::assertArrayEquals → NO_COVERAGE

893

1.1
Location : assertEquals
Killed by : none
removed call to org/junit/Assert::assertArrayEquals → NO_COVERAGE

923

1.1
Location : assertThat
Killed by : none
removed call to org/junit/Assert::assertThat → SURVIVED

956

1.1
Location : assertThat
Killed by : none
removed call to org/hamcrest/MatcherAssert::assertThat → SURVIVED

Active mutators

Tests examined


Report generated by PIT 0.32