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

skuzzle / snapshot-tests / 1

12 Feb 2025 03:38PM UTC coverage: 86.61% (+0.03%) from 86.577%
1

Pull #109

jenkins

skuzzle
Remove old file after merge
Pull Request #109: 2.0 dev

1947 of 2248 relevant lines covered (86.61%)

0.87 hits per line

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

76.47
/../snapshot-tests-core/src/main/java/de/skuzzle/test/snapshots/impl/Throwables.java
1
package de.skuzzle.test.snapshots.impl;
2

3
import static java.util.stream.Collectors.reducing;
4

5
import java.util.stream.Stream;
6

7
import de.skuzzle.test.snapshots.reflection.StackTraces;
8

9
/**
10
 * Internal utility to work with exceptions. Kind of related to {@link StackTraces} in the
11
 * common package.
12
 *
13
 * @author Simon Taddiken
14
 * @see StackTraces
15
 */
16
final class Throwables {
17

18
    private Throwables() {
19
        // hidden
20
    }
21

22
    public static void throwIfNotNull(Throwable throwable) throws Exception {
23
        if (throwable == null) {
1✔
24
            return;
1✔
25
        }
26
        if (throwable instanceof RuntimeException) {
1✔
27
            throw (RuntimeException) throwable;
1✔
28
        }
29
        if (throwable instanceof Error) {
1✔
30
            throw (Error) throwable;
1✔
31
        }
32
        if (throwable instanceof Exception) {
×
33
            throw (Exception) throwable;
×
34
        }
35
        throw new RuntimeException(throwable);
×
36
    }
37

38
    public static Throwable flattenThrowables(Stream<? extends Throwable> results) {
39
        return results
1✔
40
                .collect(reducing(Throwables::combine))
1✔
41
                .orElse(null);
1✔
42
    }
43

44
    public static Throwable combine(Throwable t, Throwable other) {
45
        if (t == null) {
1✔
46
            return other;
1✔
47
        }
48
        if (other != null) {
1✔
49
            t.addSuppressed(other);
×
50
        }
51
        return t;
1✔
52
    }
53
}
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