SymfonionExceptionThrower.java

1
package com.github.dakusui.symfonion.exception;
2
3
import com.github.dakusui.exception.ExceptionContext;
4
import com.github.dakusui.exception.ExceptionThrower;
5
6
import static com.github.dakusui.symfonion.exception.SymfonionExceptionThrower.Key.FILENAME;
7
8
public enum SymfonionExceptionThrower implements ExceptionThrower<SymfonionExceptionThrower.Key> {
9
  FILE_BROKEN {
10
    @Override
11
    public String message(ExceptionContext<Key> context) {
12 1 1. message : replaced return value with "" for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower$1::message → SURVIVED
      return "fileBroken:" + context.valueFor(FILENAME);
13
    }
14
  },
15
  JSON_ARRAY_INDEX_OUT_OF_BOUNDS {
16
    @Override
17
    public String message(ExceptionContext<Key> context) {
18
      return "";
19
    }
20
  },
21
  ;
22
23
  public enum Key implements ExceptionContext.Key {
24
    FILENAME(String.class),
25
26
    JSON_PATH_ELEMENT_INDEX(Integer.class),
27
    ;
28
29
    private final Class<?> expectedClass;
30
31
    Key(Class<?> expectedClass) {
32
      this.expectedClass = expectedClass;
33
    }
34
35
    @Override
36
    public Class<?> expectedClass() {
37 1 1. expectedClass : replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower$Key::expectedClass → SURVIVED
      return this.expectedClass;
38
    }
39
  }
40
41
  @Override
42
  public RuntimeException newException(String message, Throwable cause) {
43 1 1. newException : replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::newException → SURVIVED
    return new RuntimeException(message, cause);
44
  }
45
46
  @Override
47
  public ExceptionContext.Manager<SymfonionExceptionThrower.Key> contextManager() {
48 1 1. contextManager : replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::contextManager → SURVIVED
    return Utils.contextManager();
49
  }
50
51
  @SafeVarargs
52
  public static ExceptionContext<Key> context(ExceptionContext.Entry<Key>... entries) {
53 1 1. context : replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::context → SURVIVED
    return Utils.contextManager().open(entries);
54
  }
55
56
  public static ExceptionContext.Entry<Key> entry(Key key, Object value) {
57 1 1. entry : replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::entry → SURVIVED
    return ExceptionContext.$(key, value);
58
  }
59
60
  public static ExceptionContext.Entry<Key> $(Key key, Object value) {
61 1 1. $ : replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::$ → SURVIVED
    return entry(key, value);
62
  }
63
64
65
  enum Utils {
66
    ;
67
    private static final ThreadLocal<ExceptionContext.Manager<SymfonionExceptionThrower.Key>> EXCEPTION_CONTEXT_MANAGER_THREAD_LOCAL = ThreadLocal.withInitial(ExceptionContext.Manager::new);
68
69
    static ExceptionContext.Manager<SymfonionExceptionThrower.Key> contextManager() {
70 1 1. contextManager : replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower$Utils::contextManager → SURVIVED
      return EXCEPTION_CONTEXT_MANAGER_THREAD_LOCAL.get();
71
    }
72
  }
73
}

Mutations

12

1.1
Location : message
Killed by : none
replaced return value with "" for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower$1::message → SURVIVED
Covering tests

37

1.1
Location : expectedClass
Killed by : none
replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower$Key::expectedClass → SURVIVED
Covering tests

43

1.1
Location : newException
Killed by : none
replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::newException → SURVIVED
Covering tests

48

1.1
Location : contextManager
Killed by : none
replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::contextManager → SURVIVED
Covering tests

53

1.1
Location : context
Killed by : none
replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::context → SURVIVED
Covering tests

57

1.1
Location : entry
Killed by : none
replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::entry → SURVIVED
Covering tests

61

1.1
Location : $
Killed by : none
replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower::$ → SURVIVED
Covering tests

70

1.1
Location : contextManager
Killed by : none
replaced return value with null for com/github/dakusui/symfonion/exception/SymfonionExceptionThrower$Utils::contextManager → SURVIVED
Covering tests

Active mutators

Tests examined


Report generated by PIT 1.19.1