MethodMatcher.java

1
package com.github.dakusui.osynth.core;
2
3
import java.lang.reflect.Method;
4
import java.util.function.Function;
5
import java.util.function.Predicate;
6
7
public interface MethodMatcher {
8
  boolean test(Method m);
9
10
  default MethodMatcher and(MethodMatcher other) {
11 5 1. and : replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::and → KILLED
2. lambda$and$0 : replaced return value with "" for com/github/dakusui/osynth/core/MethodMatcher::lambda$and$0 → KILLED
3. lambda$and$1 : negated conditional → KILLED
4. lambda$and$1 : negated conditional → KILLED
5. lambda$and$1 : replaced boolean return with true for com/github/dakusui/osynth/core/MethodMatcher::lambda$and$1 → KILLED
    return create(m -> "and(" + this + "," + other + ")", v -> this.test(v) && other.test(v));
12
  }
13
14
  default MethodMatcher or(MethodMatcher other) {
15 5 1. lambda$or$2 : replaced return value with "" for com/github/dakusui/osynth/core/MethodMatcher::lambda$or$2 → SURVIVED
2. lambda$or$3 : negated conditional → KILLED
3. lambda$or$3 : negated conditional → KILLED
4. lambda$or$3 : replaced boolean return with true for com/github/dakusui/osynth/core/MethodMatcher::lambda$or$3 → KILLED
5. or : replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::or → KILLED
    return create(m -> "or(" + this + "," + other + ")", v -> this.test(v) || other.test(v));
16
  }
17
18
  default MethodMatcher negate() {
19 4 1. lambda$negate$4 : replaced return value with "" for com/github/dakusui/osynth/core/MethodMatcher::lambda$negate$4 → SURVIVED
2. lambda$negate$5 : negated conditional → KILLED
3. lambda$negate$5 : replaced boolean return with true for com/github/dakusui/osynth/core/MethodMatcher::lambda$negate$5 → KILLED
4. negate : replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::negate → KILLED
    return create(m -> "not(" + this + ")", v -> !test(v));
20
  }
21
22
  static MethodMatcher create(Function<MethodMatcher, String> toString, Predicate<Method> methodPredicate) {
23 1 1. create : replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::create → KILLED
    return PrivateUtils.methodMatcherOverrideToString(toString, create(methodPredicate));
24
  }
25
26
  static MethodMatcher create(Predicate<Method> methodPredicate) {
27 1 1. create : replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::create → KILLED
    return methodPredicate::test;
28
  }
29
30
  static MethodMatcher overrideToString(Function<MethodMatcher, String> toString, MethodMatcher methodMatcher) {
31 1 1. overrideToString : replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::overrideToString → KILLED
    return PrivateUtils.methodMatcherOverrideToString(toString, methodMatcher);
32
  }
33
34
  enum PrivateUtils {
35
    ;
36
37
    private static MethodMatcher methodMatcherOverrideToString(Function<MethodMatcher, String> toString, MethodMatcher matcher) {
38 1 1. methodMatcherOverrideToString : replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher$PrivateUtils::methodMatcherOverrideToString → KILLED
      return new MethodMatcher() {
39
        @Override
40
        public boolean test(Method m) {
41 2 1. test : replaced boolean return with false for com/github/dakusui/osynth/core/MethodMatcher$PrivateUtils$1::test → KILLED
2. test : replaced boolean return with true for com/github/dakusui/osynth/core/MethodMatcher$PrivateUtils$1::test → KILLED
          return matcher.test(m);
42
        }
43
44
        @Override
45
        public String toString() {
46 1 1. toString : replaced return value with "" for com/github/dakusui/osynth/core/MethodMatcher$PrivateUtils$1::toString → KILLED
          return toString.apply(matcher);
47
        }
48
      };
49
    }
50
  }
51
}

Mutations

11

1.1
Location : and
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest.givenMatchingExactly(com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest)
replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::and → KILLED

2.2
Location : lambda$and$0
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest.givenMatchingExactly(com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest)
replaced return value with "" for com/github/dakusui/osynth/core/MethodMatcher::lambda$and$0 → KILLED

3.3
Location : lambda$and$1
Killed by : com.github.dakusui.osynth.ut.ValidationTest.givenValidationLeftDefault$whenOneReservedMethodTriedOverridden$thenExceptionThrown(com.github.dakusui.osynth.ut.ValidationTest)
negated conditional → KILLED

4.4
Location : lambda$and$1
Killed by : com.github.dakusui.osynth.ut.ValidationTest.givenValidationLeftDefault$whenOneReservedMethodTriedOverridden$thenExceptionThrown(com.github.dakusui.osynth.ut.ValidationTest)
negated conditional → KILLED

5.5
Location : lambda$and$1
Killed by : com.github.dakusui.osynth.ut.core.SynthesizedObjectTest.equalMethodHandlerSet(com.github.dakusui.osynth.ut.core.SynthesizedObjectTest)
replaced boolean return with true for com/github/dakusui/osynth/core/MethodMatcher::lambda$and$1 → KILLED

15

1.1
Location : lambda$or$2
Killed by : none
replaced return value with "" for com/github/dakusui/osynth/core/MethodMatcher::lambda$or$2 → SURVIVED

2.2
Location : lambda$or$3
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest.examineOr(com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest)
negated conditional → KILLED

3.3
Location : lambda$or$3
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest.examineOr(com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest)
negated conditional → KILLED

4.4
Location : lambda$or$3
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest.examineOr(com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest)
replaced boolean return with true for com/github/dakusui/osynth/core/MethodMatcher::lambda$or$3 → KILLED

5.5
Location : or
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest.examineOr(com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest)
replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::or → KILLED

19

1.1
Location : lambda$negate$4
Killed by : none
replaced return value with "" for com/github/dakusui/osynth/core/MethodMatcher::lambda$negate$4 → SURVIVED

2.2
Location : lambda$negate$5
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest.examineNegateAndAnd(com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest)
negated conditional → KILLED

3.3
Location : lambda$negate$5
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest.examineNegateAndAnd(com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest)
replaced boolean return with true for com/github/dakusui/osynth/core/MethodMatcher::lambda$negate$5 → KILLED

4.4
Location : negate
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest.examineNegateAndAnd(com.github.dakusui.osynth.ut.MethodMatcherTest$CompositionTest)
replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::negate → KILLED

23

1.1
Location : create
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest.givenNameMatchingExactly(com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest)
replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::create → KILLED

27

1.1
Location : create
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest.givenAnnotatedWith2(com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest)
replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::create → KILLED

31

1.1
Location : overrideToString
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest.givenMatchingExactly(com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest)
replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher::overrideToString → KILLED

38

1.1
Location : methodMatcherOverrideToString
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest.givenNameMatchingExactly(com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest)
replaced return value with null for com/github/dakusui/osynth/core/MethodMatcher$PrivateUtils::methodMatcherOverrideToString → KILLED

41

1.1
Location : test
Killed by : com.github.dakusui.osynth.ut.ValidationTest.givenValidationLeftDefault$whenOneReservedMethodTriedOverridden$thenExceptionThrown(com.github.dakusui.osynth.ut.ValidationTest)
replaced boolean return with false for com/github/dakusui/osynth/core/MethodMatcher$PrivateUtils$1::test → KILLED

2.2
Location : test
Killed by : com.github.dakusui.osynth.compat.ut.ObjectSynthesizerTest.whenEqualsItself$thenTrue(com.github.dakusui.osynth.compat.ut.ObjectSynthesizerTest)
replaced boolean return with true for com/github/dakusui/osynth/core/MethodMatcher$PrivateUtils$1::test → KILLED

46

1.1
Location : toString
Killed by : com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest.givenNameMatchingExactly(com.github.dakusui.osynth.ut.MethodMatcherTest$ToStringTest)
replaced return value with "" for com/github/dakusui/osynth/core/MethodMatcher$PrivateUtils$1::toString → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3