ActionException.java

1
package com.github.dakusui.actionunit.exceptions;
2
3
import java.util.concurrent.TimeoutException;
4
5
/**
6
 * Encapsulate a general Action error or warning.
7
 */
8
public class ActionException extends RuntimeException {
9
  /**
10
   * Creates a new {@code ActionException} with a given message.
11
   *
12
   * @param message The detail message.
13
   */
14
  public ActionException(String message) {
15
    this(message, null);
16
  }
17
18
  /**
19
   * Creates a new {@code ActionException} from an existing exception.
20
   * The existing exception will be embedded in the new one,
21
   *
22
   * @param t The exception to be wrapped in a {@code ActionException}.
23
   */
24
  public ActionException(Throwable t) {
25
    this(null, t);
26
  }
27
28
  /**
29
   * Creates a new {@code ActionException} from an existing exception.
30
   * The existing exception will be embedded in the new one, but the new exception will have its own
31
   * message.
32
   *
33
   * @param message The detail message.
34
   * @param t       The exception to be wrapped in a {@code ActionException}.
35
   */
36
  public ActionException(String message, Throwable t) {
37
    super(message, t);
38
  }
39
40
41
  public static <T extends ActionException> T wrap(Throwable t) {
42 1 1. wrap : negated conditional → KILLED
    if (t == null) {
43
      throw new ActionException(t);
44
    }
45 1 1. wrap : negated conditional → KILLED
    if (t instanceof Error) {
46
      throw (Error) t;
47
    }
48 1 1. wrap : negated conditional → KILLED
    if (t instanceof RuntimeException) {
49
      throw (RuntimeException) t;
50
    }
51
    throw new ActionException(t.getMessage(), t);
52
  }
53
}

Mutations

42

1.1
Location : wrap
Killed by : com.github.dakusui.actionunit.ut.ActionExceptionTest.givenNullPointer$thenNullPointerThrown(com.github.dakusui.actionunit.ut.ActionExceptionTest)
negated conditional → KILLED

45

1.1
Location : wrap
Killed by : com.github.dakusui.actionunit.ut.ActionExceptionTest.givenNullPointer$thenNullPointerThrown(com.github.dakusui.actionunit.ut.ActionExceptionTest)
negated conditional → KILLED

48

1.1
Location : wrap
Killed by : com.github.dakusui.actionunit.ut.ActionExceptionTest.givenNullPointer$thenNullPointerThrown(com.github.dakusui.actionunit.ut.ActionExceptionTest)
negated conditional → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3