ThrowingRunnable.java

1
package com.renomad.minum.utils;
2
3
import com.renomad.minum.logging.ILogger;
4
5
/**
6
 * This exists so that we are able to slightly better manage
7
 * exceptions in a highly threaded system.  Here's the thing:
8
 * exceptions stop bubbling up at the thread invocation. If we
9
 * don't take care to deal with that in some way, we can easily
10
 * just lose the information.  Something could be badly broken and
11
 * we could be totally oblivious to it.  This interface is to
12
 * alleviate that situation.
13
 */
14
@FunctionalInterface
15
public interface ThrowingRunnable {
16
17
    /**
18
     * The reason this throws an exception is so that lambdas
19
     * don't need to try-catch their thrown exceptions when they
20
     * use this.
21
     */
22
    void run() throws Exception;
23
24
    static Runnable throwingRunnableWrapper(ThrowingRunnable throwingRunnable, ILogger logger) {
25 1 1. throwingRunnableWrapper : replaced return value with null for com/renomad/minum/utils/ThrowingRunnable::throwingRunnableWrapper → KILLED
        return () -> {
26
            try {
27 1 1. lambda$throwingRunnableWrapper$1 : removed call to com/renomad/minum/utils/ThrowingRunnable::run → TIMED_OUT
                throwingRunnable.run();
28
            } catch (Exception ex) {
29
                logger.logAsyncError(() -> StacktraceUtils.stackTraceToString(ex));
30
            }
31
        };
32
    }
33
}

Mutations

25

1.1
Location : throwingRunnableWrapper
Killed by : com.renomad.minum.web.FullSystemTests.testFullSystem_EdgeCase_InstantlyClosed(com.renomad.minum.web.FullSystemTests)
replaced return value with null for com/renomad/minum/utils/ThrowingRunnable::throwingRunnableWrapper → KILLED

27

1.1
Location : lambda$throwingRunnableWrapper$1
Killed by : none
removed call to com/renomad/minum/utils/ThrowingRunnable::run → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT 1.17.0