MessageUtils.java

1
package com.github.dakusui.osynth.core.utils;
2
3
import com.github.dakusui.osynth.core.MethodSignature;
4
import com.github.dakusui.osynth.core.SynthesizedObject;
5
6
import java.util.List;
7
8
import static java.lang.String.format;
9
import static java.util.stream.Collectors.joining;
10
11
public enum MessageUtils {
12
  ;
13
14
  public static String messageForMissingMethodHandler(MethodSignature methodSignature, Object object, NoSuchMethodException e) {
15 1 1. messageForMissingMethodHandler : replaced return value with "" for com/github/dakusui/osynth/core/utils/MessageUtils::messageForMissingMethodHandler → KILLED
    return format("An appropriate method handler/implementation for '%s' was not found in '%s': %s", methodSignature, object, e.getMessage());
16
  }
17
  public static String messageForMissingMethodHandler(String methodName, Class<?>[] parameterTypes, Object object, NoSuchMethodException e) {
18 1 1. messageForMissingMethodHandler : replaced return value with "" for com/github/dakusui/osynth/core/utils/MessageUtils::messageForMissingMethodHandler → KILLED
    return messageForMissingMethodHandler(MethodSignature.create(methodName, parameterTypes), object, e);
19
  }
20
21
  public static <T> String messageForAttemptToCastToUnavailableInterface(Class<T> classInUse, List<Class<?>> interfaces) {
22 1 1. messageForAttemptToCastToUnavailableInterface : replaced return value with "" for com/github/dakusui/osynth/core/utils/MessageUtils::messageForAttemptToCastToUnavailableInterface → KILLED
    return format("Tried to cast to '%s' but available interfaces are only: %s", classInUse, interfaces);
23
  }
24
25
  public static String messageForReservedMethodOverridingValidationFailure(List<Object> methodSignatures) {
26 1 1. messageForReservedMethodOverridingValidationFailure : replaced return value with "" for com/github/dakusui/osynth/core/utils/MessageUtils::messageForReservedMethodOverridingValidationFailure → KILLED
    return String.format("Reserved methods cannot be overridden. : %n%s",
27
        methodSignatures.stream()
28
            .map(Object::toString)
29
            .collect(joining(format("%n- "), "- ", format("%n"))));
30
  }
31
}

Mutations

15

1.1
Location : messageForMissingMethodHandler
Killed by : com.github.dakusui.osynth.ut.core.utils.MethodUtilsTest.testGetMethodFromClass$whenMethodNotFound$thenUnsupportedOperationExceptionRethrown(com.github.dakusui.osynth.ut.core.utils.MethodUtilsTest)
replaced return value with "" for com/github/dakusui/osynth/core/utils/MessageUtils::messageForMissingMethodHandler → KILLED

18

1.1
Location : messageForMissingMethodHandler
Killed by : com.github.dakusui.osynth.ut.core.utils.MethodUtilsTest.testGetMethodFromClass$whenMethodNotFound$thenUnsupportedOperationExceptionRethrown(com.github.dakusui.osynth.ut.core.utils.MethodUtilsTest)
replaced return value with "" for com/github/dakusui/osynth/core/utils/MessageUtils::messageForMissingMethodHandler → KILLED

22

1.1
Location : messageForAttemptToCastToUnavailableInterface
Killed by : com.github.dakusui.osynth.ut.InterfaceInclusionTest.givenInterfaceInclusionIsNotRequested$whenObjectIsCastToTestIF$thenExceptionThrown(com.github.dakusui.osynth.ut.InterfaceInclusionTest)
replaced return value with "" for com/github/dakusui/osynth/core/utils/MessageUtils::messageForAttemptToCastToUnavailableInterface → KILLED

26

1.1
Location : messageForReservedMethodOverridingValidationFailure
Killed by : com.github.dakusui.osynth.ut.ValidationTest.givenValidationLeftDefault$whenOneReservedMethodTriedOverridden$thenExceptionThrown(com.github.dakusui.osynth.ut.ValidationTest)
replaced return value with "" for com/github/dakusui/osynth/core/utils/MessageUtils::messageForReservedMethodOverridingValidationFailure → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.3