AbstractObjectTransformer.java

1
package com.github.dakusui.pcond.core.fluent;
2
3
import com.github.dakusui.pcond.core.fluent.builtins.*;
4
import com.github.dakusui.pcond.forms.Functions;
5
6
import java.util.List;
7
import java.util.function.Function;
8
import java.util.stream.Stream;
9
10
import static com.github.dakusui.pcond.core.refl.MethodQuery.classMethod;
11
import static com.github.dakusui.pcond.core.refl.MethodQuery.instanceMethod;
12
import static com.github.dakusui.pcond.forms.Functions.call;
13
import static com.github.dakusui.pcond.forms.Functions.parameter;
14
import static java.util.Objects.requireNonNull;
15
16
public interface AbstractObjectTransformer<
17
    TX extends AbstractObjectTransformer<TX, V, T, R>,
18
    V extends AbstractObjectChecker<V, T, R>,
19
    T,
20
    R
21
    > extends
22
    Transformer<TX, V, T, R> {
23
24
  /**
25
   * Corresponds to {@code toString()} method.
26
   *
27
   * @return this object the method appended.
28
   */
29
  @SuppressWarnings("unchecked")
30
  default StringTransformer<String> stringify() {
31 1 1. stringify : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::stringify → KILLED
    return (StringTransformer<String>) this.toString(Functions.stringify());
32
  }
33
34
  default <E> ObjectTransformer<T, E> invoke(String methodName, Object... args) {
35 1 1. invoke : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::invoke → KILLED
    return this.toObject(call(instanceMethod(parameter(), methodName, args)));
36
  }
37
38
  default <E> ObjectTransformer<T, E> invokeStatic(Class<?> klass, String methodName, Object... args) {
39 1 1. invokeStatic : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::invokeStatic → KILLED
    return this.toObject(call(classMethod(klass, methodName, args)));
40
  }
41
42
  default <O extends Throwable> ThrowableTransformer<T, O> expectException(Class<O> exceptionClass, Function<? super R, ?> f) {
43
    requireNonNull(exceptionClass);
44 1 1. expectException : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::expectException → KILLED
    return this.toThrowable(Functions.expectingException(exceptionClass, f));
45
  }
46
47
  @SuppressWarnings("unchecked")
48
  default <E> ObjectTransformer<T, E> asObject() {
49 1 1. asObject : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::asObject → KILLED
    return (ObjectTransformer<T, E>)this.toObject(Functions.identity());
50
  }
51
52
  default <E> ObjectTransformer<T, E> toObject(Function<R, E> function) {
53 1 1. toObject : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toObject → KILLED
    return this.transformValueWith(function, ObjectTransformer.Impl::new);
54
  }
55
56
  default BooleanTransformer<T> toBoolean(Function<? super R, Boolean> function) {
57 1 1. toBoolean : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toBoolean → KILLED
    return this.transformValueWith(function, BooleanTransformer.Impl::new);
58
  }
59
60
  default IntegerTransformer<T> toInteger(Function<? super R, Integer> function) {
61 1 1. toInteger : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toInteger → KILLED
    return this.transformValueWith(function, IntegerTransformer.Impl::new);
62
  }
63
64
  default LongTransformer<T> toLong(Function<? super R, Long> function) {
65 1 1. toLong : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toLong → KILLED
    return this.transformValueWith(function, LongTransformer.Impl::new);
66
  }
67
68
  default ShortTransformer<T> toShort(Function<? super R, Short> function) {
69 1 1. toShort : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toShort → KILLED
    return this.transformValueWith(function, ShortTransformer.Impl::new);
70
  }
71
72
  default DoubleTransformer<T> toDouble(Function<? super R, Double> function) {
73 1 1. toDouble : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toDouble → KILLED
    return this.transformValueWith(function, DoubleTransformer.Impl::new);
74
  }
75
76
  default FloatTransformer<T> toFloat(Function<? super R, Float> function) {
77 1 1. toFloat : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toFloat → KILLED
    return this.transformValueWith(function, FloatTransformer.Impl::new);
78
  }
79
80
  default StringTransformer<T> toString(Function<? super R, String> function) {
81 1 1. toString : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toString → KILLED
    return this.transformValueWith(function, StringTransformer.Impl::new);
82
  }
83
84
85
  default <E> ListTransformer<T, E> toList(Function<? super R, List<E>> function) {
86 1 1. toList : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toList → KILLED
    return this.transformValueWith(function, ListTransformer.Impl::new);
87
  }
88
89
  default <E> StreamTransformer<T, E> toStream(Function<? super R, Stream<E>> function) {
90 1 1. toStream : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toStream → KILLED
    return this.transformValueWith(function, StreamTransformer.Impl::new);
91
  }
92
93
  default <E extends Throwable> ThrowableTransformer<T, E> toThrowable(Function<? super R, E> function) {
94 1 1. toThrowable : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toThrowable → KILLED
    return this.transformValueWith(function, ThrowableTransformer.Impl::new);
95
96
  }
97
98
}

Mutations

31

1.1
Location : stringify
Killed by : com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[28: Given:<"456">:When::Then:greaterThan(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThan(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::stringify → KILLED

35

1.1
Location : invoke
Killed by : com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[28: Given:<"456">:When::Then:greaterThan(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThan(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::invoke → KILLED

39

1.1
Location : invokeStatic
Killed by : com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[28: Given:<"456">:When::Then:greaterThan(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThan(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::invokeStatic → KILLED

44

1.1
Location : expectException
Killed by : com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.expectedExceptionThrown_testPassing(com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::expectException → KILLED

49

1.1
Location : asObject
Killed by : com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[28: Given:<"456">:When::Then:greaterThan(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThan(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::asObject → KILLED

53

1.1
Location : toObject
Killed by : com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest.test_elementAt(com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toObject → KILLED

57

1.1
Location : toBoolean
Killed by : com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest.test_isEmpty(com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toBoolean → KILLED

61

1.1
Location : toInteger
Killed by : com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest.test_size(com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toInteger → KILLED

65

1.1
Location : toLong
Killed by : com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[28: Given:<"456">:When::Then:greaterThan(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThan(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toLong → KILLED

69

1.1
Location : toShort
Killed by : com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[28: Given:<"456">:When::Then:greaterThan(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThan(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toShort → KILLED

73

1.1
Location : toDouble
Killed by : com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[28: Given:<"456">:When::Then:greaterThan(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThan(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toDouble → KILLED

77

1.1
Location : toFloat
Killed by : com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest.exerciseTestCase[28: Given:<"456">:When::Then:greaterThan(1), numbersOfExpectAndActualSummaries=>areEqual, numbersOfExpectAndActualSummariesWithDetails=>areEqual, numberOfExpectDetails=>greaterThan(1), numbersOfExpectAndActualDetails=>areEqual]>](com.github.dakusui.ut.valid8j.ut.styles.fluent.GeneralFluentTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toFloat → KILLED

81

1.1
Location : toString
Killed by : com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.object_assertThatTest_passed(com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toString → KILLED

86

1.1
Location : toList
Killed by : com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.stream_assertThatTest_passed(com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toList → KILLED

90

1.1
Location : toStream
Killed by : com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest.test_stream(com.github.dakusui.ut.thincrest.ut.styles.MoreFluentListTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toStream → KILLED

94

1.1
Location : toThrowable
Killed by : com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest.expectedExceptionThrown_testPassing(com.github.dakusui.ut.thincrest.ut.styles.FluentStyleTestAssertionTest$ForTestAssertionsTest)
replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toThrowable → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3