FixedFormatPatternData.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.data;
17
18
import com.ancientprogramming.fixedformat4j.annotation.FixedFormatPattern;
19
20
import static com.ancientprogramming.fixedformat4j.annotation.FixedFormatPattern.DATE_PATTERN;
21
import static com.ancientprogramming.fixedformat4j.annotation.FixedFormatPattern.LOCALDATE_PATTERN;
22
import static com.ancientprogramming.fixedformat4j.annotation.FixedFormatPattern.DATETIME_PATTERN;
23
24
/**
25
 * Data object containing the exact same data as {@link FixedFormatPattern}
26
 *
27
 * @author Jacob von Eyben - <a href="https://eybenconsult.com">https://eybenconsult.com</a>
28
 * @since 1.0.0
29
 */
30
public class FixedFormatPatternData {
31
32
  private String pattern;
33
  public static final FixedFormatPatternData DEFAULT = new FixedFormatPatternData(DATE_PATTERN);
34
  public static final FixedFormatPatternData LOCALDATE_DEFAULT = new FixedFormatPatternData(LOCALDATE_PATTERN);
35
  public static final FixedFormatPatternData DATETIME_DEFAULT = new FixedFormatPatternData(DATETIME_PATTERN);
36
37
  /**
38
   * Creates a pattern data object with the given date/time pattern.
39
   *
40
   * @param pattern the date/time pattern string (e.g. {@code "yyyyMMdd"})
41
   */
42
  public FixedFormatPatternData(String pattern) {
43
    this.pattern = pattern;
44
  }
45
46
  /**
47
   * Returns the date/time pattern string.
48
   *
49
   * @return the pattern (e.g. {@code "yyyyMMdd"})
50
   */
51
  public String getPattern() {
52 1 1. getPattern : replaced return value with "" for com/ancientprogramming/fixedformat4j/format/data/FixedFormatPatternData::getPattern → KILLED
    return pattern;
53
  }
54
55
56
  public String toString() {
57 1 1. toString : replaced return value with "" for com/ancientprogramming/fixedformat4j/format/data/FixedFormatPatternData::toString → SURVIVED
    return String.format("FixedFormatPatternData{pattern='%s'}", pattern);
58
  }
59
}

Mutations

52

1.1
Location : getPattern
Killed by : com.ancientprogramming.fixedformat4j.format.impl.TestLocalDateTimeFormatter.[engine:junit-jupiter]/[class:com.ancientprogramming.fixedformat4j.format.impl.TestLocalDateTimeFormatter]/[method:testFormatCompactPattern()]
replaced return value with "" for com/ancientprogramming/fixedformat4j/format/data/FixedFormatPatternData::getPattern → KILLED

57

1.1
Location : toString
Killed by : none
replaced return value with "" for com/ancientprogramming/fixedformat4j/format/data/FixedFormatPatternData::toString → SURVIVED
Covering tests

Active mutators

Tests examined


Report generated by PIT 1.17.1