1 | package com.github.dakusui.pcond.forms; | |
2 | ||
3 | import com.github.dakusui.pcond.experimentals.currying.CurriedFunction; | |
4 | import com.github.dakusui.pcond.experimentals.currying.CurryingUtils; | |
5 | import com.github.dakusui.pcond.experimentals.currying.multi.MultiFunction; | |
6 | import com.github.dakusui.pcond.experimentals.currying.multi.MultiFunctionUtils; | |
7 | import com.github.dakusui.pcond.core.printable.PrintableFunctionFactory; | |
8 | import com.github.dakusui.pcond.core.refl.MethodQuery; | |
9 | import com.github.dakusui.pcond.core.refl.Parameter; | |
10 | import com.github.dakusui.pcond.validator.Validator; | |
11 | ||
12 | import java.util.Collection; | |
13 | import java.util.List; | |
14 | import java.util.NoSuchElementException; | |
15 | import java.util.function.Function; | |
16 | import java.util.function.Predicate; | |
17 | import java.util.stream.IntStream; | |
18 | import java.util.stream.Stream; | |
19 | ||
20 | import static com.github.dakusui.pcond.core.refl.ReflUtils.invokeMethod; | |
21 | import static com.github.dakusui.pcond.forms.Predicates.allOf; | |
22 | import static com.github.dakusui.pcond.forms.Predicates.isInstanceOf; | |
23 | import static com.github.dakusui.pcond.internals.InternalUtils.formatObject; | |
24 | import static java.lang.String.format; | |
25 | import static java.util.Collections.singletonList; | |
26 | import static java.util.Objects.requireNonNull; | |
27 | ||
28 | /** | |
29 | * An entry point for acquiring function objects. | |
30 | * Functions retrieved by methods in this class are all "printable". | |
31 | */ | |
32 | public class Functions { | |
33 | private Functions() { | |
34 | | |
35 | } | |
36 | | |
37 | /** | |
38 | * Returns a printable function that returns a given object itself. | |
39 | * | |
40 | * @param <E> The type of the object. | |
41 | * @return The function. | |
42 | */ | |
43 | public static <E> Function<E, E> identity() { | |
44 |
1
1. identity : replaced return value with null for com/github/dakusui/pcond/forms/Functions::identity → KILLED |
return PrintableFunctionFactory.Simple.IDENTITY.instance(); |
45 | } | |
46 | | |
47 | /** | |
48 | * Returns a function that gives a string representation of a object given to it. | |
49 | * Internally, the returned function calls `toString` method on a given object. | |
50 | * | |
51 | * @param <E> The type of the object | |
52 | * @return The function. | |
53 | */ | |
54 | public static <E> Function<E, String> stringify() { | |
55 |
1
1. stringify : replaced return value with null for com/github/dakusui/pcond/forms/Functions::stringify → KILLED |
return PrintableFunctionFactory.Simple.STRINGIFY.instance(); |
56 | } | |
57 | | |
58 | /** | |
59 | * Returns a function that gives a length of a string passed as an argument. | |
60 | * | |
61 | * @return The function. | |
62 | */ | |
63 | public static Function<? super String, Integer> length() { | |
64 |
1
1. length : replaced return value with null for com/github/dakusui/pcond/forms/Functions::length → KILLED |
return PrintableFunctionFactory.Simple.LENGTH.instance(); |
65 | } | |
66 | | |
67 | | |
68 | @SuppressWarnings({ "unchecked", "RedundantClassCall" }) | |
69 | public static <E> Function<List<E>, E> elementAt(int i) { | |
70 |
1
1. elementAt : replaced return value with null for com/github/dakusui/pcond/forms/Functions::elementAt → KILLED |
return Function.class.cast(PrintableFunctionFactory.Parameterized.ELEMENT_AT.create(singletonList(i))); |
71 | } | |
72 | | |
73 | /** | |
74 | * Returns a function that that returns a size of a given list. | |
75 | * | |
76 | * @return The function. | |
77 | */ | |
78 | public static <E> Function<Collection<E>, Integer> size() { | |
79 |
1
1. size : replaced return value with null for com/github/dakusui/pcond/forms/Functions::size → KILLED |
return PrintableFunctionFactory.Simple.SIZE.instance(); |
80 | } | |
81 | | |
82 | /** | |
83 | * Returns a function that returns a stream for a given collection. | |
84 | * | |
85 | * @param <E> Type of elements in the given collection. | |
86 | * @return The function. | |
87 | */ | |
88 | public static <E> Function<Collection<? extends E>, Stream<E>> stream() { | |
89 |
1
1. stream : replaced return value with null for com/github/dakusui/pcond/forms/Functions::stream → KILLED |
return PrintableFunctionFactory.Simple.STREAM.instance(); |
90 | } | |
91 | | |
92 | /** | |
93 | * Returns a function that returns a stream for a given collection. | |
94 | * | |
95 | * @param elementClass A parameter to let compiler know the type of the element in a collection. | |
96 | * @param <E> A type of elements in a collection. | |
97 | * @return The function. | |
98 | */ | |
99 | public static <E> Function<Collection<? extends E>, Stream<E>> stream(@SuppressWarnings("unused") Class<E> elementClass) { | |
100 |
1
1. stream : replaced return value with null for com/github/dakusui/pcond/forms/Functions::stream → KILLED |
return stream(); |
101 | } | |
102 | | |
103 | /** | |
104 | * Returns a function that returns a stream for a given object. | |
105 | * This method corresponds to {@link Stream#of(Object)} method. | |
106 | * | |
107 | * @param <E> Type of object. | |
108 | * @return The function. | |
109 | */ | |
110 | public static <E> Function<E, Stream<E>> streamOf() { | |
111 |
1
1. streamOf : replaced return value with null for com/github/dakusui/pcond/forms/Functions::streamOf → KILLED |
return PrintableFunctionFactory.Simple.STREAM_OF.instance(); |
112 | } | |
113 | | |
114 | /** | |
115 | * Returns a function that casts an object into a given class. | |
116 | * | |
117 | * @param type The type to which the given object is cast | |
118 | * @param <E> The type to which the object is case. | |
119 | * @return The function. | |
120 | */ | |
121 | public static <E> Function<? super Object, E> cast(Class<E> type) { | |
122 |
1
1. cast : replaced return value with null for com/github/dakusui/pcond/forms/Functions::cast → KILLED |
return PrintableFunctionFactory.Parameterized.CAST.create(singletonList(type)); |
123 | } | |
124 | | |
125 | /** | |
126 | * Returns a function that casts an object into a given class. | |
127 | * ```java | |
128 | * assertThat( | |
129 | * asList(lastName, fullName), | |
130 | * allOf( | |
131 | * transform(elementAt(0).andThen(cast(String.class))).check(allOf(isNotNull(), not(isEmptyString()))), | |
132 | * transform(elementAt(1).andThen(castTo((List<String>)value()))).check(Predicates.contains(lastName)))); | |
133 | * ``` | |
134 | * | |
135 | * @param value A type place-holder. | |
136 | * Always use a value returned from {@link Functions#value()} method. | |
137 | * @param <E> The type to which the object is case. | |
138 | * @return The function. | |
139 | */ | |
140 | public static <E> Function<? super Object, E> castTo(@SuppressWarnings("unused") E value) { | |
141 |
1
1. castTo : replaced return value with null for com/github/dakusui/pcond/forms/Functions::castTo → NO_COVERAGE |
return PrintableFunctionFactory.Simple.CAST_TO.instance(); |
142 | } | |
143 | ||
144 | /** | |
145 | * Returns a function that creates and returns a list that contains all the elements in the given list. | |
146 | * | |
147 | * @param <I> The type of the input collection. | |
148 | * @param <E> Type of the elements in the collection | |
149 | * @return The function. | |
150 | */ | |
151 | public static <I extends Collection<E>, E> Function<I, List<E>> collectionToList() { | |
152 |
1
1. collectionToList : replaced return value with null for com/github/dakusui/pcond/forms/Functions::collectionToList → KILLED |
return PrintableFunctionFactory.Simple.COLLECTION_TO_LIST.instance(); |
153 | } | |
154 | | |
155 | /** | |
156 | * Returns a function that converts a given array into a list. | |
157 | * | |
158 | * @param <E> Type of elements in a given array. | |
159 | * @return The function. | |
160 | */ | |
161 | public static <E> Function<E[], List<E>> arrayToList() { | |
162 |
1
1. arrayToList : replaced return value with null for com/github/dakusui/pcond/forms/Functions::arrayToList → KILLED |
return PrintableFunctionFactory.Simple.ARRAY_TO_LIST.instance(); |
163 | } | |
164 | | |
165 | /** | |
166 | * Returns a function the counts lines in a given string. | |
167 | * | |
168 | * @return The function. | |
169 | */ | |
170 | public static Function<String, Integer> countLines() { | |
171 |
1
1. countLines : replaced return value with null for com/github/dakusui/pcond/forms/Functions::countLines → KILLED |
return PrintableFunctionFactory.Simple.COUNT_LINES.instance(); |
172 | } | |
173 | | |
174 | /** | |
175 | * //@formatter:off | |
176 | * The returned function tries to find a {@code substring} after a given string. | |
177 | * If found, it returns the result of the following statement. | |
178 | * | |
179 | * [source,java] | |
180 | * ---- | |
181 | * s.substring(s.indexOf(substring) + substring.length()) | |
182 | * ---- | |
183 | * | |
184 | * If not found, a {@link StringIndexOutOfBoundsException} will be thrown. | |
185 | * //@formatter:on | |
186 | * | |
187 | * @param substring A substring to find in a given string. | |
188 | * @return The string after the {@code substring}. | |
189 | */ | |
190 | public static Function<String, String> findString(String substring) { | |
191 | requireNonNull(substring); | |
192 |
1
1. findString : replaced return value with null for com/github/dakusui/pcond/forms/Functions::findString → KILLED |
return PrintableFunctionFactory.function( |
193 |
1
1. lambda$findString$0 : replaced return value with "" for com/github/dakusui/pcond/forms/Functions::lambda$findString$0 → NO_COVERAGE |
() -> format("findString[%s]", substring), |
194 | s -> { | |
195 | int index = s.indexOf(substring); | |
196 |
2
1. lambda$findString$1 : changed conditional boundary → SURVIVED 2. lambda$findString$1 : negated conditional → SURVIVED |
if (index >= 0) |
197 |
2
1. lambda$findString$1 : replaced return value with "" for com/github/dakusui/pcond/forms/Functions::lambda$findString$1 → SURVIVED 2. lambda$findString$1 : Replaced integer addition with subtraction → KILLED |
return s.substring(s.indexOf(substring) + substring.length()); |
198 | throw new NoSuchElementException(format("'%s' was not found in '%s'", substring, s)); | |
199 | }); | |
200 | } | |
201 | | |
202 | /** | |
203 | * https://en.wikipedia.org/wiki/Currying[Curries] a static method specified by the given arguments. | |
204 | * | |
205 | * @param aClass A class to which the method to be curried belongs to. | |
206 | * @param methodName A name of the method to be curried. | |
207 | * @param parameterTypes Parameters types of the method. | |
208 | * @return A printable and curried function of the target method. | |
209 | */ | |
210 | @SuppressWarnings("JavadocLinkAsPlainText") | |
211 | public static CurriedFunction<Object, Object> curry(Class<?> aClass, String methodName, Class<?>... parameterTypes) { | |
212 |
1
1. curry : replaced return value with null for com/github/dakusui/pcond/forms/Functions::curry → KILLED |
return curry(multifunction(aClass, methodName, parameterTypes)); |
213 | } | |
214 | | |
215 | /** | |
216 | * Curries a given multi-function. | |
217 | * | |
218 | * @param function A multi-function to be curried | |
219 | * @return A curried function | |
220 | * @see Functions#curry(Class, String, Class[]) | |
221 | */ | |
222 | public static CurriedFunction<Object, Object> curry(MultiFunction<Object> function) { | |
223 |
1
1. curry : replaced return value with null for com/github/dakusui/pcond/forms/Functions::curry → KILLED |
return CurryingUtils.curry(function); |
224 | } | |
225 | | |
226 | public static <R> MultiFunction<R> multifunction(Class<?> aClass, String methodName, Class<?>... parameterTypes) { | |
227 |
1
1. multifunction : replaced return value with null for com/github/dakusui/pcond/forms/Functions::multifunction → KILLED |
return MultiFunctionUtils.multifunction(IntStream.range(0, parameterTypes.length).toArray(), aClass, methodName, parameterTypes); |
228 | } | |
229 | | |
230 | /** | |
231 | * Returns a {@link Function} created from a method specified by a {@code methodQuery}. | |
232 | * If the {@code methodQuery} matches none or more than one methods, a {@code RuntimeException} will be thrown. | |
233 | * | |
234 | * To pass an input value given to an entry point method, such as `TestAssertions.assertThat`, to the method, use a place-holder value returned by {@link Functions#parameter()}. | |
235 | * | |
236 | * @param methodQuery A query object that specifies a method to be invoked by the returned function. | |
237 | * @param <T> the type of the input to the returned function | |
238 | * @return Created function. | |
239 | * @see Functions#classMethod(Class, String, Object[]) | |
240 | * @see Functions#instanceMethod(Object, String, Object[]) | |
241 | * @see Functions#parameter() | |
242 | */ | |
243 | public static <T, R> Function<T, R> call(MethodQuery methodQuery) { | |
244 |
5
1. call : replaced return value with null for com/github/dakusui/pcond/forms/Functions::call → KILLED 2. lambda$call$4 : replaced return value with null for com/github/dakusui/pcond/forms/Functions::lambda$call$4 → KILLED 3. lambda$null$2 : replaced boolean return with false for com/github/dakusui/pcond/forms/Functions::lambda$null$2 → KILLED 4. lambda$null$2 : replaced boolean return with true for com/github/dakusui/pcond/forms/Functions::lambda$null$2 → KILLED 5. lambda$null$3 : replaced return value with null for com/github/dakusui/pcond/forms/Functions::lambda$null$3 → KILLED |
return Printables.function(methodQuery.describe(), t -> invokeMethod(methodQuery.bindActualArguments((o) -> o instanceof Parameter, o -> t))); |
245 | } | |
246 | | |
247 | | |
248 | /** | |
249 | * // @formatter:off | |
250 | * Creates a {@link MethodQuery} object from given arguments to search for {@code static} methods. | |
251 | * Note that {@code arguments} are actual argument values, not the formal parameter types. | |
252 | * The pcond library searches for the "best" matching method for you. | |
253 | * In case no matching method is found or more than one methods are found, a {@link RuntimeException} | |
254 | * will be thrown. | |
255 | * | |
256 | * In order to specify a parameter which should be passed to the returned function at applying, | |
257 | * you can use an object returned by {@link Functions#parameter} method. | |
258 | * This is useful to construct a function from an existing method. | |
259 | * | |
260 | * To pass an input value given to an entry point method, such as `TestAssertions.assertThat`, to the method, use a place-holder value returned by {@link Functions#parameter()}. | |
261 | * | |
262 | * That is, in order to create a function which computes sin using query a method {@link Math#sin(double)}, | |
263 | * you can do following | |
264 | * | |
265 | * [source, java] | |
266 | * ---- | |
267 | * public class Example | |
268 | * public void buildSinFunction() { | |
269 | * MethodQuery mq = classMethod(Math.class, "sin", parameter()); | |
270 | * Function<Double, Double> sin = call(mq); | |
271 | * System.out.println(sin(Math.PI/2)); | |
272 | * } | |
273 | * } | |
274 | * ---- | |
275 | * This prints {@code 1.0}. | |
276 | * | |
277 | * In case your arguments do not contain any {@link Parameter} object, the input | |
278 | * argument passed to the built function will be simply ignored. | |
279 | * | |
280 | * // @formatter:on | |
281 | * | |
282 | * @param targetClass A class | |
283 | * @param methodName A method name | |
284 | * @param arguments Arguments | |
285 | * @return A method query for static methods specified by arguments. | |
286 | * @see com.github.dakusui.pcond.core.refl.ReflUtils#findMethod(Class, String, Object[]) | |
287 | * @see Functions#parameter() | |
288 | */ | |
289 | public static MethodQuery classMethod(Class<?> targetClass, String methodName, Object... arguments) { | |
290 |
1
1. classMethod : replaced return value with null for com/github/dakusui/pcond/forms/Functions::classMethod → KILLED |
return MethodQuery.classMethod(targetClass, methodName, arguments); |
291 | } | |
292 | | |
293 | /** | |
294 | * // @formatter:off | |
295 | * Creates a {@link MethodQuery} object from given arguments to search for {@code static} methods. | |
296 | * Excepting that this method returns a query for instance methods, it is quite | |
297 | * similar to {@link Functions#classMethod(Class, String, Object[])}. | |
298 | * | |
299 | * This method is useful to build a function from an instance method. | |
300 | * That is, you can create a function which returns the length of a given string | |
301 | * from a method {@link String#length()} with a following code snippet. | |
302 | * | |
303 | * [source, java] | |
304 | * ---- | |
305 | * public void buildLengthFunction() { | |
306 | * Function<String, Integer> length = call(instanceMethod(parameter(), "length")); | |
307 | * } | |
308 | * ---- | |
309 | * | |
310 | * In case the {@code targetObject} is not an instance of {@link Parameter} and {@code arguments} | |
311 | * contain no {@code Parameter} object, the function will simply ignore the input passed to it. | |
312 | * | |
313 | * To pass an input value given to an entry point method, such as `TestAssertions.assertThat`, to the method, use a place-holder value returned by {@link Functions#parameter()}. | |
314 | * | |
315 | * // @formatter:on | |
316 | * | |
317 | * @param targetObject An object on which methods matching returned query should be invoked. | |
318 | * @param methodName A name of method. | |
319 | * @param arguments Arguments passed to the method. | |
320 | * @return A method query for instance methods specified by arguments. | |
321 | * @see Functions#classMethod(Class, String, Object[]) | |
322 | * @see Functions#parameter() | |
323 | */ | |
324 | public static MethodQuery instanceMethod(Object targetObject, String methodName, Object... arguments) { | |
325 |
1
1. instanceMethod : replaced return value with null for com/github/dakusui/pcond/forms/Functions::instanceMethod → KILLED |
return MethodQuery.instanceMethod(targetObject, methodName, arguments); |
326 | } | |
327 | | |
328 | /** | |
329 | * // @formatter:off | |
330 | * A short hand method to call | |
331 | * | |
332 | * [source, java] | |
333 | * --- | |
334 | * call(instanceMethod(object, methodName, args)) | |
335 | * --- | |
336 | * // @formatter:on | |
337 | * | |
338 | * To pass an input value given to an entry point method, such as `TestAssertions.assertThat`, to the method, use a place-holder value returned by {@link Functions#parameter()}. | |
339 | * | |
340 | * @param targetObject An object on which methods matching returned query should be invoked. | |
341 | * @param methodName A name of method. | |
342 | * @param arguments Arguments passed to the method. | |
343 | * @param <T> The type of the input to the returned function. | |
344 | * @param <R> The type of the output from the returned function. | |
345 | * @return The function that calls a method matching a query built from the given arguments. | |
346 | * @see Functions#call(MethodQuery) | |
347 | * @see Functions#instanceMethod(Object, String, Object[]) | |
348 | * @see Functions#parameter() | |
349 | */ | |
350 | private static <T, R> Function<T, R> callInstanceMethod(Object targetObject, String methodName, Object... arguments) { | |
351 |
1
1. callInstanceMethod : replaced return value with null for com/github/dakusui/pcond/forms/Functions::callInstanceMethod → KILLED |
return call(instanceMethod(targetObject, methodName, arguments)); |
352 | } | |
353 | | |
354 | /** | |
355 | * Returns a function that calls a method which matches the given {@code methodName} | |
356 | * and {@code args} on the object given as input to it. | |
357 | * | |
358 | * Note that method look up is done when the predicate is applied. | |
359 | * This means this method does not throw any exception by itself and in case | |
360 | * you give wrong {@code methodName} or {@code arguments}, an exception will be | |
361 | * thrown when the returned function is applied. | |
362 | * | |
363 | * // @formatter:off | |
364 | * [source, java] | |
365 | * ---- | |
366 | * public class Example { | |
367 | * public void method() { | |
368 | * assertThat(value, transform(call("toString")).check(isNotNull())); | |
369 | * } | |
370 | * } | |
371 | * ---- | |
372 | * | |
373 | * To pass an input value given to an entry point method, such as `TestAssertions.assertThat`, to the method, use a place-holder value returned by {@link Functions#parameter()}. | |
374 | * | |
375 | * // @formatter:on | |
376 | * | |
377 | * @param methodName The method name | |
378 | * @param arguments Arguments passed to the method. | |
379 | * @param <T> The type of input to the returned function | |
380 | * @param <R> The type of output from the returned function | |
381 | * @return A function that invokes the method matching the {@code methodName} and {@code args} | |
382 | * @see Functions#parameter() | |
383 | */ | |
384 | public static <T, R> Function<T, R> call(String methodName, Object... arguments) { | |
385 |
1
1. call : replaced return value with null for com/github/dakusui/pcond/forms/Functions::call → KILLED |
return callInstanceMethod(parameter(), methodName, arguments); |
386 | } | |
387 | | |
388 | /** | |
389 | * Returns a function that converts an input value to an exception object, which is thrown by `func`, when it is applied. | |
390 | * If it does not throw an exception, or even if thrown, it is not an instance of {@code exceptionClass}, an assertion executed inside this method will fail and an exception | |
391 | * to indicate it will be thrown. | |
392 | * The exception will be typically an {@link AssertionError}. | |
393 | * | |
394 | * @param exceptionClass An exception class to be thrown. | |
395 | * @param func A function to be exercised | |
396 | * @param <T> A type of exception value to be thrown by {@code func}. | |
397 | * @param <E> An input value type of {@code func}. | |
398 | * @return A function that maps an input value to an exception. | |
399 | */ | |
400 | @SuppressWarnings("unchecked") | |
401 | public static <T, E extends Throwable> Function<T, E> expectingException(Class<E> exceptionClass, Function<? super T, ?> func) { | |
402 |
1
1. expectingException : replaced return value with null for com/github/dakusui/pcond/forms/Functions::expectingException → KILLED |
return Printables.function( |
403 |
1
1. lambda$expectingException$5 : replaced return value with "" for com/github/dakusui/pcond/forms/Functions::lambda$expectingException$5 → SURVIVED |
() -> String.format("expectingException(%s,%s)", exceptionClass.getSimpleName(), func), |
404 | in -> { | |
405 | Object out; | |
406 | try { | |
407 | out = func.apply(in); | |
408 | } catch (Throwable e) { | |
409 |
1
1. lambda$expectingException$6 : removed call to com/github/dakusui/pcond/validator/Validator::assertThat → KILLED |
Validator.instance().assertThat(e, isInstanceOf(exceptionClass)); |
410 |
1
1. lambda$expectingException$6 : replaced return value with null for com/github/dakusui/pcond/forms/Functions::lambda$expectingException$6 → KILLED |
return (E) e; |
411 | } | |
412 |
1
1. lambda$expectingException$6 : removed call to com/github/dakusui/pcond/validator/Validator::assertThat → KILLED |
Validator.instance().assertThat( |
413 | String.format("%s(%s)->%s", func, formatObject(in, 12), formatObject(out, 12)), | |
414 | allOf(exceptionThrown(), exceptionClassWas(exceptionClass))); | |
415 | throw new AssertionError("A line that shouldn't be reached. File a ticket."); | |
416 | }); | |
417 | } | |
418 | | |
419 | /** | |
420 | * Returns a {@link Parameter} object, which is used in combination with {@link Functions#instanceMethod(Object, String, Object[])}, | |
421 | * {@link Functions#classMethod(Class, String, Object[])}, or their shorthand methods. | |
422 | * The object returned by this method is replaced with the actual input value passed to a function built | |
423 | * through {@link Functions#call(MethodQuery)} or {@link Predicates#callp(MethodQuery)} | |
424 | * when it is applied. | |
425 | * | |
426 | * @return a {@code Parameter} object | |
427 | * @see Functions#classMethod(Class, String, Object[]) | |
428 | * @see Functions#instanceMethod(Object, String, Object[]) | |
429 | * @see Functions#call(MethodQuery) | |
430 | * @see Functions#call(String, Object[]) | |
431 | * @see Predicates#callp(MethodQuery) | |
432 | * @see Predicates#callp(String, Object[]) | |
433 | */ | |
434 | public static Parameter parameter() { | |
435 |
1
1. parameter : replaced return value with null for com/github/dakusui/pcond/forms/Functions::parameter → KILLED |
return Parameter.INSTANCE; |
436 | } | |
437 | | |
438 | private static Predicate<Object> exceptionThrown() { | |
439 |
2
1. lambda$exceptionThrown$7 : replaced boolean return with true for com/github/dakusui/pcond/forms/Functions::lambda$exceptionThrown$7 → SURVIVED 2. exceptionThrown : replaced return value with null for com/github/dakusui/pcond/forms/Functions::exceptionThrown → KILLED |
return Printables.predicate("exceptionThrown", v -> false); |
440 | } | |
441 | | |
442 | private static Predicate<Object> exceptionClassWas(Class<? extends Throwable> exceptionClass) { | |
443 |
3
1. exceptionClassWas : replaced return value with null for com/github/dakusui/pcond/forms/Functions::exceptionClassWas → KILLED 2. lambda$exceptionClassWas$8 : replaced return value with "" for com/github/dakusui/pcond/forms/Functions::lambda$exceptionClassWas$8 → KILLED 3. lambda$exceptionClassWas$9 : replaced boolean return with true for com/github/dakusui/pcond/forms/Functions::lambda$exceptionClassWas$9 → KILLED |
return Printables.predicate(() -> "exceptionClass:" + requireNonNull(exceptionClass).getSimpleName(), v -> false); |
444 | } | |
445 | ||
446 | /** | |
447 | * A method to return a value for a "casting placeholder value". | |
448 | * | |
449 | * @param <E> Type to cast to. | |
450 | * @return Casting placeholder value | |
451 | */ | |
452 | public static <E> E value() { | |
453 | return null; | |
454 | } | |
455 | } | |
Mutations | ||
44 |
1.1 |
|
55 |
1.1 |
|
64 |
1.1 |
|
70 |
1.1 |
|
79 |
1.1 |
|
89 |
1.1 |
|
100 |
1.1 |
|
111 |
1.1 |
|
122 |
1.1 |
|
141 |
1.1 |
|
152 |
1.1 |
|
162 |
1.1 |
|
171 |
1.1 |
|
192 |
1.1 |
|
193 |
1.1 |
|
196 |
1.1 2.2 |
|
197 |
1.1 2.2 |
|
212 |
1.1 |
|
223 |
1.1 |
|
227 |
1.1 |
|
244 |
1.1 2.2 3.3 4.4 5.5 |
|
290 |
1.1 |
|
325 |
1.1 |
|
351 |
1.1 |
|
385 |
1.1 |
|
402 |
1.1 |
|
403 |
1.1 |
|
409 |
1.1 |
|
410 |
1.1 |
|
412 |
1.1 |
|
435 |
1.1 |
|
439 |
1.1 2.2 |
|
443 |
1.1 2.2 3.3 |