EnumFormatter.java

1
/*
2
 * Copyright 2004 the original author or authors.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.ancientprogramming.fixedformat4j.format.impl;
17
18
import com.ancientprogramming.fixedformat4j.annotation.EnumFormat;
19
import com.ancientprogramming.fixedformat4j.exception.FixedFormatException;
20
import com.ancientprogramming.fixedformat4j.format.AbstractFixedFormatter;
21
import com.ancientprogramming.fixedformat4j.format.FormatContext;
22
import com.ancientprogramming.fixedformat4j.format.FormatInstructions;
23
import com.ancientprogramming.fixedformat4j.format.data.FixedFormatEnumData;
24
25
/**
26
 * Formatter for Java enum types.
27
 *
28
 * <p>Supports two serialization modes controlled by {@code @FixedFormatEnum}:
29
 * <ul>
30
 *   <li>{@link EnumFormat#LITERAL} (default) — uses {@link Enum#name()} / {@link Enum#valueOf}</li>
31
 *   <li>{@link EnumFormat#NUMERIC} — uses {@link Enum#ordinal()} / index lookup</li>
32
 * </ul>
33
 *
34
 * <p>Padding is handled by the {@link AbstractFixedFormatter} base class using the field's
35
 * configured {@code paddingChar} and {@code align}. This formatter receives a padding-stripped
36
 * value in {@link #asObject} and must not apply additional whitespace-specific trimming,
37
 * so non-space padding characters (e.g. {@code '*'}, {@code '0'}) are handled correctly.
38
 *
39
 * @author Jacob von Eyben - <a href="https://eybenconsult.com">https://eybenconsult.com</a>
40
 * @since 1.7.0
41
 */
42
public class EnumFormatter extends AbstractFixedFormatter<Enum> {
43
44
  private final FormatContext<?> context;
45
46
  /**
47
   * Lazily cached constants of the context's enum type, in ordinal order. Cached because
48
   * {@link Class#getEnumConstants()} clones the array on every call. The array is never
49
   * exposed or mutated; the benign race on first initialization is harmless.
50
   */
51
  private volatile Enum<?>[] constants;
52
53
  /**
54
   * Creates an {@code EnumFormatter} bound to the given format context.
55
   * The context's data type must be an enum class.
56
   *
57
   * @param context the format context describing the field's data type
58
   */
59
  public EnumFormatter(FormatContext<?> context) {
60 1 1. <init> : Removed assignment to member variable context → KILLED
    this.context = context;
61
  }
62
63
  /**
64
   * {@inheritDoc}
65
   *
66
   * <p>The {@code value} received here has already had its padding stripped by
67
   * {@link AbstractFixedFormatter#parse} using the field's actual {@code paddingChar},
68
   * so no additional trimming is performed.
69
   */
70
  @SuppressWarnings({"unchecked", "rawtypes"})
71
  @Override
72
  public Enum asObject(String value, FormatInstructions instructions) {
73 3 1. asObject : removed conditional - replaced equality check with false → SURVIVED
2. asObject : negated conditional → KILLED
3. asObject : removed conditional - replaced equality check with true → KILLED
    if (value == null) {
74
      return null;
75
    }
76 4 1. asObject : negated conditional → KILLED
2. asObject : removed conditional - replaced equality check with true → KILLED
3. asObject : removed conditional - replaced equality check with false → KILLED
4. asObject : removed call to java/lang/String::isEmpty → KILLED
    if (value.isEmpty()) {
77
      // In NUMERIC mode with '0' padding, padding-stripping consumes an all-zeros field
78
      // entirely — but those zeros WERE the value (ordinal 0), not a blank field.
79
      // Mirrors the empty-means-"0" convention of Sign.remove for numeric fields.
80 9 1. asObject : Substituted 48 with 49 → KILLED
2. asObject : removed call to com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::enumFormat → KILLED
3. asObject : removed call to com/ancientprogramming/fixedformat4j/format/FormatInstructions::getPaddingChar → KILLED
4. asObject : removed conditional - replaced equality check with false → KILLED
5. asObject : removed conditional - replaced equality check with false → KILLED
6. asObject : negated conditional → KILLED
7. asObject : negated conditional → KILLED
8. asObject : removed conditional - replaced equality check with true → KILLED
9. asObject : removed conditional - replaced equality check with true → KILLED
      if (enumFormat(instructions) == EnumFormat.NUMERIC && instructions.getPaddingChar() == '0') {
81
        value = "0";
82
      } else {
83
        return null;
84
      }
85
    }
86 1 1. asObject : removed call to com/ancientprogramming/fixedformat4j/format/FormatContext::getDataType → KILLED
    Class<? extends Enum> enumClass = (Class<? extends Enum>) context.getDataType();
87 1 1. asObject : removed call to com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::enumFormat → KILLED
    EnumFormat format = enumFormat(instructions);
88 3 1. asObject : removed conditional - replaced equality check with false → KILLED
2. asObject : removed conditional - replaced equality check with true → KILLED
3. asObject : negated conditional → KILLED
    if (format == EnumFormat.NUMERIC) {
89
      int ordinal;
90
      try {
91 1 1. asObject : removed call to java/lang/Integer::parseInt → KILLED
        ordinal = Integer.parseInt(value);
92
      } catch (NumberFormatException e) {
93 2 1. asObject : Substituted 2 with 3 → SURVIVED
2. asObject : Substituted 0 with 1 → KILLED
        throw new FixedFormatException(
94 5 1. asObject : replaced call to java/lang/String::format with argument → KILLED
2. asObject : removed call to java/lang/Class::getName → KILLED
3. asObject : Substituted 1 with 0 → KILLED
4. asObject : removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatException::<init> → KILLED
5. asObject : removed call to java/lang/String::format → KILLED
            String.format("Cannot parse ordinal for enum [%s] from value [%s]", enumClass.getName(), value), e);
95
      }
96 1 1. asObject : removed call to com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::constantsOf → KILLED
      Enum<?>[] constants = constantsOf(enumClass);
97 8 1. asObject : changed conditional boundary → SURVIVED
2. asObject : negated conditional → KILLED
3. asObject : negated conditional → KILLED
4. asObject : removed conditional - replaced comparison check with false → KILLED
5. asObject : changed conditional boundary → KILLED
6. asObject : removed conditional - replaced comparison check with false → KILLED
7. asObject : removed conditional - replaced comparison check with true → KILLED
8. asObject : removed conditional - replaced comparison check with true → KILLED
      if (ordinal < 0 || ordinal >= constants.length) {
98 2 1. asObject : Substituted 3 with 4 → SURVIVED
2. asObject : Substituted 0 with 1 → KILLED
        throw new FixedFormatException(
99 10 1. asObject : Substituted 1 with 0 → SURVIVED
2. asObject : Replaced integer subtraction with addition → SURVIVED
3. asObject : removed call to java/lang/Class::getName → SURVIVED
4. asObject : removed call to java/lang/Integer::valueOf → SURVIVED
5. asObject : Substituted 1 with 0 → KILLED
6. asObject : removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatException::<init> → KILLED
7. asObject : removed call to java/lang/String::format → KILLED
8. asObject : replaced call to java/lang/String::format with argument → KILLED
9. asObject : removed call to java/lang/Integer::valueOf → KILLED
10. asObject : Substituted 2 with 3 → KILLED
            String.format("Ordinal [%d] is out of range for enum [%s] (valid range: 0..%d)", ordinal, enumClass.getName(), constants.length - 1));
100
      }
101 1 1. asObject : replaced return value with null for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::asObject → KILLED
      return constants[ordinal];
102
    } else {
103
      try {
104 2 1. asObject : removed call to java/lang/Enum::valueOf → KILLED
2. asObject : replaced return value with null for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::asObject → KILLED
        return Enum.valueOf(enumClass, value);
105
      } catch (IllegalArgumentException e) {
106 3 1. asObject : Substituted 2 with 3 → SURVIVED
2. asObject : Substituted 1 with 0 → KILLED
3. asObject : Substituted 0 with 1 → KILLED
        throw new FixedFormatException(
107 4 1. asObject : replaced call to java/lang/String::format with argument → KILLED
2. asObject : removed call to java/lang/String::format → KILLED
3. asObject : removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatException::<init> → KILLED
4. asObject : removed call to java/lang/Class::getName → KILLED
            String.format("Cannot find enum constant [%s] in [%s]", value, enumClass.getName()), e);
108
      }
109
    }
110
  }
111
112
  /** {@inheritDoc} */
113
  @Override
114
  public String asString(Enum value, FormatInstructions instructions) {
115 3 1. asString : negated conditional → KILLED
2. asString : removed conditional - replaced equality check with true → KILLED
3. asString : removed conditional - replaced equality check with false → KILLED
    if (value == null) {
116
      return "";
117
    }
118 5 1. asString : negated conditional → KILLED
2. asString : removed call to com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::enumFormat → KILLED
3. asString : removed conditional - replaced equality check with true → KILLED
4. asString : removed conditional - replaced equality check with false → KILLED
5. asString : replaced return value with "" for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::asString → KILLED
    return enumFormat(instructions) == EnumFormat.NUMERIC
119 2 1. asString : removed call to java/lang/String::valueOf → KILLED
2. asString : removed call to java/lang/Enum::ordinal → KILLED
        ? String.valueOf(value.ordinal())
120 1 1. asString : removed call to java/lang/Enum::name → KILLED
        : value.name();
121
  }
122
123
  @SuppressWarnings("rawtypes")
124
  private Enum<?>[] constantsOf(Class<? extends Enum> enumClass) {
125
    Enum<?>[] result = constants;
126 3 1. constantsOf : removed conditional - replaced equality check with true → SURVIVED
2. constantsOf : removed conditional - replaced equality check with false → KILLED
3. constantsOf : negated conditional → KILLED
    if (result == null) {
127 1 1. constantsOf : removed call to java/lang/Class::getEnumConstants → KILLED
      result = enumClass.getEnumConstants();
128 1 1. constantsOf : Removed assignment to member variable constants → SURVIVED
      constants = result;
129
    }
130 1 1. constantsOf : replaced return value with null for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::constantsOf → KILLED
    return result;
131
  }
132
133
  private EnumFormat enumFormat(FormatInstructions instructions) {
134 1 1. enumFormat : removed call to com/ancientprogramming/fixedformat4j/format/FormatInstructions::getFixedFormatEnumData → KILLED
    FixedFormatEnumData data = instructions.getFixedFormatEnumData();
135 5 1. enumFormat : removed conditional - replaced equality check with true → SURVIVED
2. enumFormat : removed conditional - replaced equality check with false → KILLED
3. enumFormat : removed call to com/ancientprogramming/fixedformat4j/format/data/FixedFormatEnumData::getEnumFormat → KILLED
4. enumFormat : negated conditional → KILLED
5. enumFormat : replaced return value with null for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::enumFormat → KILLED
    return (data != null) ? data.getEnumFormat() : EnumFormat.LITERAL;
136
  }
137
}

Mutations

60

1.1
Location : <init>
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_throwsFixedFormatException()]
Removed assignment to member variable context → KILLED

73

1.1
Location : asObject
Killed by : none
removed conditional - replaced equality check with false → SURVIVED
Covering tests

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_throwsFixedFormatException()]
negated conditional → KILLED

3.3
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_throwsFixedFormatException()]
removed conditional - replaced equality check with true → KILLED

76

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_throwsFixedFormatException()]
negated conditional → KILLED

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_throwsFixedFormatException()]
removed conditional - replaced equality check with true → KILLED

3.3
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:literalAllZeroPaddingInput_stillParsesToNull()]
removed conditional - replaced equality check with false → KILLED

4.4
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:literalAllZeroPaddingInput_stillParsesToNull()]
removed call to java/lang/String::isEmpty → KILLED

80

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericOrdinalZeroWithZeroPadding_leftAlign_roundTrips()]
Substituted 48 with 49 → KILLED

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericOrdinalZeroWithZeroPadding_leftAlign_roundTrips()]
removed call to com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::enumFormat → KILLED

3.3
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericOrdinalZeroWithZeroPadding_leftAlign_roundTrips()]
removed call to com/ancientprogramming/fixedformat4j/format/FormatInstructions::getPaddingChar → KILLED

4.4
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericOrdinalZeroWithZeroPadding_leftAlign_roundTrips()]
removed conditional - replaced equality check with false → KILLED

5.5
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericOrdinalZeroWithZeroPadding_leftAlign_roundTrips()]
removed conditional - replaced equality check with false → KILLED

6.6
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:literalAllZeroPaddingInput_stillParsesToNull()]
negated conditional → KILLED

7.7
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericBlankWithSpacePadding_stillParsesToNull()]
negated conditional → KILLED

8.8
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:literalAllZeroPaddingInput_stillParsesToNull()]
removed conditional - replaced equality check with true → KILLED

9.9
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericBlankWithSpacePadding_stillParsesToNull()]
removed conditional - replaced equality check with true → KILLED

86

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_throwsFixedFormatException()]
removed call to com/ancientprogramming/fixedformat4j/format/FormatContext::getDataType → KILLED

87

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
removed call to com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::enumFormat → KILLED

88

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
removed conditional - replaced equality check with false → KILLED

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullEnumData_defaultsToLiteralBehavior_parse()]
removed conditional - replaced equality check with true → KILLED

3.3
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullEnumData_defaultsToLiteralBehavior_parse()]
negated conditional → KILLED

91

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_throwsFixedFormatException()]
removed call to java/lang/Integer::parseInt → KILLED

93

1.1
Location : asObject
Killed by : none
Substituted 2 with 3 → SURVIVED
Covering tests

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
Substituted 0 with 1 → KILLED

94

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
replaced call to java/lang/String::format with argument → KILLED

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
removed call to java/lang/Class::getName → KILLED

3.3
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
Substituted 1 with 0 → KILLED

4.4
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_throwsFixedFormatException()]
removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatException::<init> → KILLED

5.5
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
removed call to java/lang/String::format → KILLED

96

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
removed call to com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::constantsOf → KILLED

97

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:rightAlignedNumericParse_stripsLeadingSpaces()]
negated conditional → KILLED

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
negated conditional → KILLED

3.3
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
removed conditional - replaced comparison check with false → KILLED

4.4
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericParse_ordinalZeroIsRed()]
changed conditional boundary → KILLED

5.5
Location : asObject
Killed by : none
changed conditional boundary → SURVIVED
Covering tests

6.6
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:rightAlignedNumericParse_stripsLeadingSpaces()]
removed conditional - replaced comparison check with false → KILLED

7.7
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_negative_exceptionMessageMentionsOutOfRange()]
removed conditional - replaced comparison check with true → KILLED

8.8
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:rightAlignedNumericParse_stripsLeadingSpaces()]
removed conditional - replaced comparison check with true → KILLED

98

1.1
Location : asObject
Killed by : none
Substituted 3 with 4 → SURVIVED
Covering tests

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_exceptionMessageMentionsOutOfRange()]
Substituted 0 with 1 → KILLED

99

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
Substituted 1 with 0 → KILLED

2.2
Location : asObject
Killed by : none
Substituted 1 with 0 → SURVIVED
Covering tests

3.3
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatException::<init> → KILLED

4.4
Location : asObject
Killed by : none
Replaced integer subtraction with addition → SURVIVED Covering tests

5.5
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_exceptionMessageMentionsOutOfRange()]
removed call to java/lang/String::format → KILLED

6.6
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_exceptionMessageMentionsOutOfRange()]
replaced call to java/lang/String::format with argument → KILLED

7.7
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_exceptionMessageMentionsOutOfRange()]
removed call to java/lang/Integer::valueOf → KILLED

8.8
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
Substituted 2 with 3 → KILLED

9.9
Location : asObject
Killed by : none
removed call to java/lang/Class::getName → SURVIVED Covering tests

10.10
Location : asObject
Killed by : none
removed call to java/lang/Integer::valueOf → SURVIVED Covering tests

101

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:rightAlignedNumericParse_stripsLeadingSpaces()]
replaced return value with null for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::asObject → KILLED

104

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullEnumData_defaultsToLiteralBehavior_parse()]
removed call to java/lang/Enum::valueOf → KILLED

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullEnumData_defaultsToLiteralBehavior_parse()]
replaced return value with null for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::asObject → KILLED

106

1.1
Location : asObject
Killed by : none
Substituted 2 with 3 → SURVIVED
Covering tests

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:unknownLiteralName_exceptionMessageContainsBadValue()]
Substituted 1 with 0 → KILLED

3.3
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:unknownLiteralName_exceptionMessageContainsBadValue()]
Substituted 0 with 1 → KILLED

107

1.1
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:unknownLiteralName_exceptionMessageContainsBadValue()]
replaced call to java/lang/String::format with argument → KILLED

2.2
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:unknownLiteralName_exceptionMessageContainsBadValue()]
removed call to java/lang/String::format → KILLED

3.3
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:unknownLiteralName_throwsFixedFormatException()]
removed call to com/ancientprogramming/fixedformat4j/exception/FixedFormatException::<init> → KILLED

4.4
Location : asObject
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:unknownLiteralName_exceptionMessageContainsEnumClassName()]
removed call to java/lang/Class::getName → KILLED

115

1.1
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullValue_numeric_formatsToAllPadding()]
negated conditional → KILLED

2.2
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullEnumData_defaultsToLiteralBehavior_format()]
removed conditional - replaced equality check with true → KILLED

3.3
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullValue_numeric_formatsToAllPadding()]
removed conditional - replaced equality check with false → KILLED

118

1.1
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullEnumData_defaultsToLiteralBehavior_format()]
negated conditional → KILLED

2.2
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericFormat_blueIsOrdinalTwo()]
removed call to com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::enumFormat → KILLED

3.3
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullEnumData_defaultsToLiteralBehavior_format()]
removed conditional - replaced equality check with true → KILLED

4.4
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericFormat_blueIsOrdinalTwo()]
removed conditional - replaced equality check with false → KILLED

5.5
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nullEnumData_defaultsToLiteralBehavior_format()]
replaced return value with "" for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::asString → KILLED

119

1.1
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericFormat_blueIsOrdinalTwo()]
removed call to java/lang/String::valueOf → KILLED

2.2
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:numericFormat_blueIsOrdinalTwo()]
removed call to java/lang/Enum::ordinal → KILLED

120

1.1
Location : asString
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:literalFormat_blueProducesBlueString()]
removed call to java/lang/Enum::name → KILLED

126

1.1
Location : constantsOf
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
removed conditional - replaced equality check with false → KILLED

2.2
Location : constantsOf
Killed by : none
removed conditional - replaced equality check with true → SURVIVED
Covering tests

3.3
Location : constantsOf
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
negated conditional → KILLED

127

1.1
Location : constantsOf
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
removed call to java/lang/Class::getEnumConstants → KILLED

128

1.1
Location : constantsOf
Killed by : none
Removed assignment to member variable constants → SURVIVED
Covering tests

130

1.1
Location : constantsOf
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:outOfRangeOrdinal_positive_throwsFixedFormatException()]
replaced return value with null for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::constantsOf → KILLED

134

1.1
Location : enumFormat
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
removed call to com/ancientprogramming/fixedformat4j/format/FormatInstructions::getFixedFormatEnumData → KILLED

135

1.1
Location : enumFormat
Killed by : none
removed conditional - replaced equality check with true → SURVIVED
Covering tests

2.2
Location : enumFormat
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
removed conditional - replaced equality check with false → KILLED

3.3
Location : enumFormat
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
removed call to com/ancientprogramming/fixedformat4j/format/data/FixedFormatEnumData::getEnumFormat → KILLED

4.4
Location : enumFormat
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
negated conditional → KILLED

5.5
Location : enumFormat
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestEnumFormatter]/[method:nonNumericOrdinal_exceptionMessageMentionsCannotParseOrdinal()]
replaced return value with null for com/ancientprogramming/fixedformat4j/format/impl/EnumFormatter::enumFormat → KILLED

Active mutators

Tests examined


Report generated by PIT 1.23.1 support