# player.java

1

    package re.forestier.edu.rpg;

2

3

    import java.util.ArrayList;

4

    import java.util.HashMap;

5

6

    public class player {

7

        public String playerName;

8

        public String Avatar_name;

9

        private String AvatarClass;

10

11

        public Integer money;

12

        private Float __real_money__;

13

14

        public int level;

15

        public int healthpoints;

16

        public int currenthealthpoints;

17

        protected int xp;

18

19

        public HashMap<String, Integer> abilities; //Ability = stat

20

        public ArrayList<String> inventory;

21

22

        public player(String playerName, String avatar_name, String avatarClass, int money, ArrayList<String> inventory) {

23

3 1. <init> : negated conditional → KILLED
2. <init> : negated conditional → KILLED
3. <init> : negated conditional → KILLED

            if (!avatarClass.equals("ARCHER") && !avatarClass.equals("ADVENTURER") && !avatarClass.equals("DWARF"))

24

            {

25

                return;

26

            }

27

28

            this.playerName = playerName;

29

            Avatar_name = avatar_name;

30

            AvatarClass = avatarClass;

31

            this.money = Integer.valueOf(money);

32

            this.inventory = inventory;

33

            this.abilities = UpdatePlayer.abilitiesPerTypeAndLevel().get(AvatarClass).get(1);

34

        }

35

36

        public String getAvatarClass () {

37

1 1. getAvatarClass : replaced return value with "" for re/forestier/edu/rpg/player::getAvatarClass → KILLED

            return AvatarClass;

38

        }

39

40

        public void removeMoney(int amount) throws IllegalArgumentException {

41

3 1. removeMoney : changed conditional boundary → KILLED
2. removeMoney : Replaced integer subtraction with addition → KILLED
3. removeMoney : negated conditional → KILLED

            if (money - amount < 0) {

42

                throw new IllegalArgumentException("Player can't have a negative money!");

43

            }

44

45

1 1. removeMoney : Replaced integer subtraction with addition → KILLED

            money = Integer.parseInt(money.toString()) - amount;

46

        }

47

        public void addMoney(int amount) {

48

            var value = Integer.valueOf(amount);

49

2 1. addMoney : negated conditional → KILLED
2. addMoney : Replaced integer addition with subtraction → KILLED

            money = money + (value != null ? value : 0);

50

        }

51

        public int retrieveLevel() {

52

            // (lvl-1) * 10 + round((lvl * xplvl-1)/4)

53

            HashMap<Integer, Integer> levels = new HashMap<>();

54

            levels.put(2,10); // 1*10 + ((2*0)/4)

55

            levels.put(3,27); // 2*10 + ((3*10)/4)

56

            levels.put(4,57); // 3*10 + ((4*27)/4)

57

            levels.put(5,111); // 4*10 + ((5*57)/4)

58

            //TODO : ajouter les prochains niveaux

59

60

2 1. retrieveLevel : changed conditional boundary → KILLED
2. retrieveLevel : negated conditional → KILLED

            if (xp < levels.get(2)) {

61

1 1. retrieveLevel : replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED

                return 1;

62

            }

63

3 1. retrieveLevel : negated conditional → KILLED
2. retrieveLevel : replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED
3. retrieveLevel : changed conditional boundary → KILLED

            else if (xp < levels.get(3)) {return 2;

64

            }

65

2 1. retrieveLevel : negated conditional → KILLED
2. retrieveLevel : changed conditional boundary → KILLED

            if (xp < levels.get(4)) {

66

1 1. retrieveLevel : replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED

                return 3;

67

            }

68

3 1. retrieveLevel : negated conditional → KILLED
2. retrieveLevel : changed conditional boundary → KILLED
3. retrieveLevel : replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED

            if (xp < levels.get(5)) return 4;

69

1 1. retrieveLevel : replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED

            return 5;

70

        }

71

72

        public int getXp() {

73

1 1. getXp : replaced int return with 0 for re/forestier/edu/rpg/player::getXp → KILLED

            return this.xp;

74

        }

75

76

        /*

77

        Ингредиенты:

78

            Для теста:

79

80

                250 г муки

81

                125 г сливочного масла (холодное)

82

                70 г сахара

83

                1 яйцо

84

                1 щепотка соли

85

         */

86

87

    }

## Mutations

23

1.1
Location : <init>
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testPlayerName()] negated conditional → KILLED

2.2
Location : <init>
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testPlayerConstructor()] negated conditional → KILLED

3.3
Location : <init>
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testPlayerConstructor()] negated conditional → KILLED

37 |  | 1.1 Location : getAvatarClass Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] replaced return value with "" for re/forestier/edu/rpg/player::getAvatarClass → KILLED

41

1.1
Location : removeMoney
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRemoveMoney()] changed conditional boundary → KILLED

2.2
Location : removeMoney
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRemoveMoney()] Replaced integer subtraction with addition → KILLED

3.3
Location : removeMoney
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRemoveMoney()] negated conditional → KILLED

45 |  | 1.1 Location : removeMoney Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRemoveMoney()] Replaced integer subtraction with addition → KILLED
49 |  | 1.1 Location : addMoney Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testAddMoney()] negated conditional → KILLED 2.2 Location : addMoney Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testAddMoney()] Replaced integer addition with subtraction → KILLED
60 |  | 1.1 Location : retrieveLevel Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] changed conditional boundary → KILLED 2.2 Location : retrieveLevel Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testAfficage()] negated conditional → KILLED
61 |  | 1.1 Location : retrieveLevel Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testAfficage()] replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED

63

1.1
Location : retrieveLevel
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] negated conditional → KILLED

2.2
Location : retrieveLevel
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED

3.3
Location : retrieveLevel
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] changed conditional boundary → KILLED

65 |  | 1.1 Location : retrieveLevel Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] negated conditional → KILLED 2.2 Location : retrieveLevel Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] changed conditional boundary → KILLED
66 |  | 1.1 Location : retrieveLevel Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED

68

1.1
Location : retrieveLevel
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] negated conditional → KILLED

2.2
Location : retrieveLevel
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] changed conditional boundary → KILLED

3.3
Location : retrieveLevel
Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED

69 |  | 1.1 Location : retrieveLevel Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] replaced int return with 0 for re/forestier/edu/rpg/player::retrieveLevel → KILLED
73 |  | 1.1 Location : getXp Killed by : re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] replaced int return with 0 for re/forestier/edu/rpg/player::getXp → KILLED

## Active mutators

- CONDITIONALS_BOUNDARY
- EMPTY_RETURNS
- FALSE_RETURNS
- INCREMENTS
- INVERT_NEGS
- MATH
- NEGATE_CONDITIONALS
- NULL_RETURNS
- PRIMITIVE_RETURNS
- TRUE_RETURNS
- VOID_METHOD_CALLS

## Tests examined

- re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRetrieveLevel()] (0 ms)
- re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testMajFinTour()] (0 ms)
- re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testPlayerName()] (0 ms)
- re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testAddMoney()] (0 ms)
- re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testPlayerConstructor()] (0 ms)
- re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testAfficage()] (0 ms)
- re.forestier.edu.UnitTests.[engine:junit-jupiter]/[class:re.forestier.edu.UnitTests]/[method:testRemoveMoney()] (1 ms)
- re.forestier.edu.GlobalTest.[engine:junit-jupiter]/[class:re.forestier.edu.GlobalTest]/[method:testAffichageBase()] (135 ms)

Report generated by PIT 1.15.0