Colour.java

1
package sh.okx.rankup.util;
2
3
import net.md_5.bungee.api.ChatColor;
4
5
public class Colour {
6
7
  private static final char altColorChar = '&';
8
9
  public static String translate(String string) {
10
    StringBuilder result = new StringBuilder();
11
    char[] b = string.toCharArray();
12 2 1. translate : changed conditional boundary → KILLED
2. translate : negated conditional → KILLED
    for (int i = 0; i < b.length; i++) {
13 4 1. translate : changed conditional boundary → SURVIVED
2. translate : Replaced integer subtraction with addition → SURVIVED
3. translate : negated conditional → KILLED
4. translate : negated conditional → KILLED
      if (b[i] == altColorChar && i < b.length - 1) {
14 3 1. translate : changed conditional boundary → SURVIVED
2. translate : Replaced integer addition with subtraction → KILLED
3. translate : negated conditional → KILLED
        if ("0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) {
15 1 1. translate : Replaced integer addition with subtraction → KILLED
          result.append(ChatColor.COLOR_CHAR).append(Character.toLowerCase(b[i + 1]));
16 1 1. translate : Changed increment from 1 to -1 → TIMED_OUT
          i ++;
17 5 1. translate : changed conditional boundary → NO_COVERAGE
2. translate : Replaced integer addition with subtraction → NO_COVERAGE
3. translate : Replaced integer subtraction with addition → NO_COVERAGE
4. translate : negated conditional → NO_COVERAGE
5. translate : negated conditional → NO_COVERAGE
        } else if ('#' == b[i + 1] && i < b.length - 7) {
18 2 1. translate : Replaced integer addition with subtraction → NO_COVERAGE
2. translate : Replaced integer addition with subtraction → NO_COVERAGE
          String hex = string.substring(i + 1, i + 8);
19
          result.append(ChatColor.of(hex));
20 1 1. translate : Changed increment from 7 to -7 → NO_COVERAGE
          i += 7;
21
        } else {
22
          result.append(b[i]);
23
        }
24
      } else {
25
        result.append(b[i]);
26
      }
27
    }
28 1 1. translate : replaced return value with "" for sh/okx/rankup/util/Colour::translate → KILLED
    return result.toString();
29
  }
30
}

Mutations

12

1.1
Location : translate
Killed by : sh.okx.rankup.pebble.PebbleTest.[engine:junit-jupiter]/[class:sh.okx.rankup.pebble.PebbleTest]/[method:testRequirementAbsent()]
changed conditional boundary → KILLED

2.2
Location : translate
Killed by : sh.okx.rankup.pebble.PebbleTest.[engine:junit-jupiter]/[class:sh.okx.rankup.pebble.PebbleTest]/[method:testRequirementAbsent()]
negated conditional → KILLED

13

1.1
Location : translate
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : translate
Killed by : none
Replaced integer subtraction with addition → SURVIVED

3.3
Location : translate
Killed by : sh.okx.rankup.pebble.PebbleTest.[engine:junit-jupiter]/[class:sh.okx.rankup.pebble.PebbleTest]/[method:testRequirementAbsent()]
negated conditional → KILLED

4.4
Location : translate
Killed by : sh.okx.rankup.prestige.BrokenPrestigeTest.[engine:junit-jupiter]/[class:sh.okx.rankup.prestige.BrokenPrestigeTest]/[method:testPrestige()]
negated conditional → KILLED

14

1.1
Location : translate
Killed by : none
changed conditional boundary → SURVIVED

2.2
Location : translate
Killed by : sh.okx.rankup.RankupBasicsTest.[engine:junit-jupiter]/[class:sh.okx.rankup.RankupBasicsTest]/[method:testNotInLadder()]
Replaced integer addition with subtraction → KILLED

3.3
Location : translate
Killed by : sh.okx.rankup.prestige.BrokenPrestigeTest.[engine:junit-jupiter]/[class:sh.okx.rankup.prestige.BrokenPrestigeTest]/[method:testPrestige()]
negated conditional → KILLED

15

1.1
Location : translate
Killed by : sh.okx.rankup.RankupBasicsTest.[engine:junit-jupiter]/[class:sh.okx.rankup.RankupBasicsTest]/[method:testNotInLadder()]
Replaced integer addition with subtraction → KILLED

16

1.1
Location : translate
Killed by : none
Changed increment from 1 to -1 → TIMED_OUT

17

1.1
Location : translate
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : translate
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

3.3
Location : translate
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

4.4
Location : translate
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : translate
Killed by : none
negated conditional → NO_COVERAGE

18

1.1
Location : translate
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

2.2
Location : translate
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

20

1.1
Location : translate
Killed by : none
Changed increment from 7 to -7 → NO_COVERAGE

28

1.1
Location : translate
Killed by : sh.okx.rankup.pebble.PebbleTest.[engine:junit-jupiter]/[class:sh.okx.rankup.pebble.PebbleTest]/[method:testRequirementAbsent()]
replaced return value with "" for sh/okx/rankup/util/Colour::translate → KILLED

Active mutators

Tests examined


Report generated by PIT 1.7.0