suppression de retrivelevel, introduction enum ability et job
clcolmerau

clcolmerau commited on 2024-11-27 15:32:07
Showing 71 changed files, with 516 additions and 181 deletions.

... ...
@@ -0,0 +1,33 @@
1
+plugins {
2
+    id 'application'
3
+    id 'java'
4
+    id "jacoco"
5
+    id 'info.solidsoft.pitest' version '1.15.0'
6
+}
7
+
8
+application {
9
+   mainClass = "re.forestier.edu.Main"
10
+}
11
+
12
+group = 're.forestier.edu'
13
+version = '1.0-SNAPSHOT'
14
+
15
+repositories {
16
+    mavenCentral()
17
+}
18
+
19
+dependencies {
20
+    testImplementation platform('org.junit:junit-bom:5.10.0')
21
+    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
22
+    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
23
+    testImplementation 'org.pitest:pitest-junit5-plugin:1.1.1'
24
+    testImplementation("com.approvaltests:approvaltests:15.6.0")
25
+    implementation 'org.hamcrest:hamcrest:2.2'
26
+    implementation("org.freemarker:freemarker:2.3.30")
27
+
28
+
29
+}
30
+
31
+test {
32
+    useJUnitPlatform()
33
+}
0 34
\ No newline at end of file
... ...
@@ -1,9 +1,13 @@
1 1
 plugins {
2
+id 'application'
2 3
     id 'java'
3 4
     id "jacoco"
4 5
     id 'info.solidsoft.pitest' version '1.15.0'
5 6
 }
6 7
 
8
+application{
9
+	mainClass = 're.forestier.edu.Main'
10
+}
7 11
 group = 're.forestier.edu'
8 12
 version = '1.0-SNAPSHOT'
9 13
 
... ...
@@ -41,7 +41,7 @@
41 41
 </td>
42 42
 <td>
43 43
 <div class="infoBox" id="duration">
44
-<div class="counter">0.173s</div>
44
+<div class="counter">0.169s</div>
45 45
 <p>duration</p>
46 46
 </div>
47 47
 </td>
... ...
@@ -76,7 +76,7 @@
76 76
 </thead>
77 77
 <tr>
78 78
 <td class="success">testAffichageBase()</td>
79
-<td class="success">0.173s</td>
79
+<td class="success">0.169s</td>
80 80
 <td class="success">passed</td>
81 81
 </tr>
82 82
 </table>
... ...
@@ -89,7 +89,7 @@
89 89
 <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
90 90
 </label>
91 91
 </div>Generated by 
92
-<a href="http://www.gradle.org">Gradle 8.8</a> at 24 oct. 2024, 17:41:14</p>
92
+<a href="http://www.gradle.org">Gradle 8.8</a> at 27 nov. 2024, 15:31:35</p>
93 93
 </div>
94 94
 </div>
95 95
 </body>
... ...
@@ -41,7 +41,7 @@
41 41
 </td>
42 42
 <td>
43 43
 <div class="infoBox" id="duration">
44
-<div class="counter">0.015s</div>
44
+<div class="counter">0.022s</div>
45 45
 <p>duration</p>
46 46
 </div>
47 47
 </td>
... ...
@@ -78,7 +78,7 @@
78 78
 <tr>
79 79
 <td class="success">addMoney</td>
80 80
 <td class="success">testAddMoney()</td>
81
-<td class="success">0.001s</td>
81
+<td class="success">0s</td>
82 82
 <td class="success">passed</td>
83 83
 </tr>
84 84
 <tr>
... ...
@@ -96,19 +96,19 @@
96 96
 <tr>
97 97
 <td class="success">majDeFinDeTour</td>
98 98
 <td class="success">testMajFinTour()</td>
99
-<td class="success">0.001s</td>
99
+<td class="success">0.003s</td>
100 100
 <td class="success">passed</td>
101 101
 </tr>
102 102
 <tr>
103 103
 <td class="success">Natural Tests</td>
104 104
 <td class="success">testNatural()</td>
105
-<td class="success">0.001s</td>
105
+<td class="success">0.002s</td>
106 106
 <td class="success">passed</td>
107 107
 </tr>
108 108
 <tr>
109 109
 <td class="success">Constructor Player</td>
110 110
 <td class="success">testPlayerConstructor()</td>
111
-<td class="success">0s</td>
111
+<td class="success">0.001s</td>
112 112
 <td class="success">passed</td>
113 113
 </tr>
114 114
 <tr>
... ...
@@ -120,19 +120,19 @@
120 120
 <tr>
121 121
 <td class="success">removeMoney</td>
122 122
 <td class="success">testRemoveMoney()</td>
123
-<td class="success">0.004s</td>
123
+<td class="success">0.006s</td>
124 124
 <td class="success">passed</td>
125 125
 </tr>
126 126
 <tr>
127 127
 <td class="success">ex &amp; lvl</td>
128 128
 <td class="success">testRetrieveLevel()</td>
129
-<td class="success">0.002s</td>
129
+<td class="success">0.003s</td>
130 130
 <td class="success">passed</td>
131 131
 </tr>
132 132
 <tr>
133 133
 <td class="success">Construcor UpdatePlayer</td>
134 134
 <td class="success">testUpdatePlayer()</td>
135
-<td class="success">0s</td>
135
+<td class="success">0.001s</td>
136 136
 <td class="success">passed</td>
137 137
 </tr>
138 138
 </table>
... ...
@@ -145,7 +145,7 @@
145 145
 <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
146 146
 </label>
147 147
 </div>Generated by 
148
-<a href="http://www.gradle.org">Gradle 8.8</a> at 24 oct. 2024, 17:41:14</p>
148
+<a href="http://www.gradle.org">Gradle 8.8</a> at 27 nov. 2024, 15:31:35</p>
149 149
 </div>
150 150
 </div>
151 151
 </body>
... ...
@@ -38,7 +38,7 @@
38 38
 </td>
39 39
 <td>
40 40
 <div class="infoBox" id="duration">
41
-<div class="counter">0.188s</div>
41
+<div class="counter">0.191s</div>
42 42
 <p>duration</p>
43 43
 </div>
44 44
 </td>
... ...
@@ -85,7 +85,7 @@
85 85
 <td>11</td>
86 86
 <td>0</td>
87 87
 <td>0</td>
88
-<td>0.188s</td>
88
+<td>0.191s</td>
89 89
 <td class="success">100%</td>
90 90
 </tr>
91 91
 </tbody>
... ...
@@ -112,7 +112,7 @@
112 112
 <td>1</td>
113 113
 <td>0</td>
114 114
 <td>0</td>
115
-<td>0.173s</td>
115
+<td>0.169s</td>
116 116
 <td class="success">100%</td>
117 117
 </tr>
118 118
 <tr>
... ...
@@ -122,7 +122,7 @@
122 122
 <td>10</td>
123 123
 <td>0</td>
124 124
 <td>0</td>
125
-<td>0.015s</td>
125
+<td>0.022s</td>
126 126
 <td class="success">100%</td>
127 127
 </tr>
128 128
 </tbody>
... ...
@@ -136,7 +136,7 @@
136 136
 <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
137 137
 </label>
138 138
 </div>Generated by 
139
-<a href="http://www.gradle.org">Gradle 8.8</a> at 24 oct. 2024, 17:41:14</p>
139
+<a href="http://www.gradle.org">Gradle 8.8</a> at 27 nov. 2024, 15:31:35</p>
140 140
 </div>
141 141
 </div>
142 142
 </body>
... ...
@@ -40,7 +40,7 @@
40 40
 </td>
41 41
 <td>
42 42
 <div class="infoBox" id="duration">
43
-<div class="counter">0.188s</div>
43
+<div class="counter">0.191s</div>
44 44
 <p>duration</p>
45 45
 </div>
46 46
 </td>
... ...
@@ -83,7 +83,7 @@
83 83
 <td>1</td>
84 84
 <td>0</td>
85 85
 <td>0</td>
86
-<td>0.173s</td>
86
+<td>0.169s</td>
87 87
 <td class="success">100%</td>
88 88
 </tr>
89 89
 <tr>
... ...
@@ -93,7 +93,7 @@
93 93
 <td>10</td>
94 94
 <td>0</td>
95 95
 <td>0</td>
96
-<td>0.015s</td>
96
+<td>0.022s</td>
97 97
 <td class="success">100%</td>
98 98
 </tr>
99 99
 </table>
... ...
@@ -106,7 +106,7 @@
106 106
 <input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
107 107
 </label>
108 108
 </div>Generated by 
109
-<a href="http://www.gradle.org">Gradle 8.8</a> at 24 oct. 2024, 17:41:14</p>
109
+<a href="http://www.gradle.org">Gradle 8.8</a> at 27 nov. 2024, 15:31:35</p>
110 110
 </div>
111 111
 </div>
112 112
 </body>
... ...
@@ -0,0 +1,248 @@
1
+#!/bin/sh
2
+
3
+#
4
+# Copyright © 2015-2021 the original authors.
5
+#
6
+# Licensed under the Apache License, Version 2.0 (the "License");
7
+# you may not use this file except in compliance with the License.
8
+# You may obtain a copy of the License at
9
+#
10
+#      https://www.apache.org/licenses/LICENSE-2.0
11
+#
12
+# Unless required by applicable law or agreed to in writing, software
13
+# distributed under the License is distributed on an "AS IS" BASIS,
14
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+# See the License for the specific language governing permissions and
16
+# limitations under the License.
17
+#
18
+
19
+##############################################################################
20
+#
21
+#   kata start up script for POSIX generated by Gradle.
22
+#
23
+#   Important for running:
24
+#
25
+#   (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26
+#       noncompliant, but you have some other compliant shell such as ksh or
27
+#       bash, then to run this script, type that shell name before the whole
28
+#       command line, like:
29
+#
30
+#           ksh kata
31
+#
32
+#       Busybox and similar reduced shells will NOT work, because this script
33
+#       requires all of these POSIX shell features:
34
+#         * functions;
35
+#         * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36
+#           «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37
+#         * compound commands having a testable exit status, especially «case»;
38
+#         * various built-in commands including «command», «set», and «ulimit».
39
+#
40
+#   Important for patching:
41
+#
42
+#   (2) This script targets any POSIX shell, so it avoids extensions provided
43
+#       by Bash, Ksh, etc; in particular arrays are avoided.
44
+#
45
+#       The "traditional" practice of packing multiple parameters into a
46
+#       space-separated string is a well documented source of bugs and security
47
+#       problems, so this is (mostly) avoided, by progressively accumulating
48
+#       options in "$@", and eventually passing that to Java.
49
+#
50
+#       Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51
+#       and KATA_OPTS) rely on word-splitting, this is performed explicitly;
52
+#       see the in-line comments for details.
53
+#
54
+#       There are tweaks for specific operating systems such as AIX, CygWin,
55
+#       Darwin, MinGW, and NonStop.
56
+#
57
+#   (3) This script is generated from the Groovy template
58
+#       https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
+#       within the Gradle project.
60
+#
61
+#       You can find Gradle at https://github.com/gradle/gradle/.
62
+#
63
+##############################################################################
64
+
65
+# Attempt to set APP_HOME
66
+
67
+# Resolve links: $0 may be a link
68
+app_path=$0
69
+
70
+# Need this for daisy-chained symlinks.
71
+while
72
+    APP_HOME=${app_path%"${app_path##*/}"}  # leaves a trailing /; empty if no leading path
73
+    [ -h "$app_path" ]
74
+do
75
+    ls=$( ls -ld "$app_path" )
76
+    link=${ls#*' -> '}
77
+    case $link in             #(
78
+      /*)   app_path=$link ;; #(
79
+      *)    app_path=$APP_HOME$link ;;
80
+    esac
81
+done
82
+
83
+# This is normally unused
84
+# shellcheck disable=SC2034
85
+APP_BASE_NAME=${0##*/}
86
+# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87
+APP_HOME=$( cd "${APP_HOME:-./}.." > /dev/null && pwd -P ) || exit
88
+
89
+# Use the maximum available, or set MAX_FD != -1 to use that value.
90
+MAX_FD=maximum
91
+
92
+warn () {
93
+    echo "$*"
94
+} >&2
95
+
96
+die () {
97
+    echo
98
+    echo "$*"
99
+    echo
100
+    exit 1
101
+} >&2
102
+
103
+# OS specific support (must be 'true' or 'false').
104
+cygwin=false
105
+msys=false
106
+darwin=false
107
+nonstop=false
108
+case "$( uname )" in                #(
109
+  CYGWIN* )         cygwin=true  ;; #(
110
+  Darwin* )         darwin=true  ;; #(
111
+  MSYS* | MINGW* )  msys=true    ;; #(
112
+  NONSTOP* )        nonstop=true ;;
113
+esac
114
+
115
+CLASSPATH=$APP_HOME/lib/kata-1.0-SNAPSHOT.jar:$APP_HOME/lib/hamcrest-2.2.jar:$APP_HOME/lib/freemarker-2.3.30.jar
116
+
117
+
118
+# Determine the Java command to use to start the JVM.
119
+if [ -n "$JAVA_HOME" ] ; then
120
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121
+        # IBM's JDK on AIX uses strange locations for the executables
122
+        JAVACMD=$JAVA_HOME/jre/sh/java
123
+    else
124
+        JAVACMD=$JAVA_HOME/bin/java
125
+    fi
126
+    if [ ! -x "$JAVACMD" ] ; then
127
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128
+
129
+Please set the JAVA_HOME variable in your environment to match the
130
+location of your Java installation."
131
+    fi
132
+else
133
+    JAVACMD=java
134
+    if ! command -v java >/dev/null 2>&1
135
+    then
136
+        die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
+
138
+Please set the JAVA_HOME variable in your environment to match the
139
+location of your Java installation."
140
+    fi
141
+fi
142
+
143
+# Increase the maximum file descriptors if we can.
144
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
145
+    case $MAX_FD in #(
146
+      max*)
147
+        # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148
+        # shellcheck disable=SC2039,SC3045
149
+        MAX_FD=$( ulimit -H -n ) ||
150
+            warn "Could not query maximum file descriptor limit"
151
+    esac
152
+    case $MAX_FD in  #(
153
+      '' | soft) :;; #(
154
+      *)
155
+        # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156
+        # shellcheck disable=SC2039,SC3045
157
+        ulimit -n "$MAX_FD" ||
158
+            warn "Could not set maximum file descriptor limit to $MAX_FD"
159
+    esac
160
+fi
161
+
162
+# Collect all arguments for the java command, stacking in reverse order:
163
+#   * args from the command line
164
+#   * the main class name
165
+#   * -classpath
166
+#   * -D...appname settings
167
+#   * --module-path (only if needed)
168
+#   * DEFAULT_JVM_OPTS, JAVA_OPTS, and KATA_OPTS environment variables.
169
+
170
+# For Cygwin or MSYS, switch paths to Windows format before running java
171
+if "$cygwin" || "$msys" ; then
172
+    APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
173
+    CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
174
+
175
+    JAVACMD=$( cygpath --unix "$JAVACMD" )
176
+
177
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
178
+    for arg do
179
+        if
180
+            case $arg in                                #(
181
+              -*)   false ;;                            # don't mess with options #(
182
+              /?*)  t=${arg#/} t=/${t%%/*}              # looks like a POSIX filepath
183
+                    [ -e "$t" ] ;;                      #(
184
+              *)    false ;;
185
+            esac
186
+        then
187
+            arg=$( cygpath --path --ignore --mixed "$arg" )
188
+        fi
189
+        # Roll the args list around exactly as many times as the number of
190
+        # args, so each arg winds up back in the position where it started, but
191
+        # possibly modified.
192
+        #
193
+        # NB: a `for` loop captures its iteration list before it begins, so
194
+        # changing the positional parameters here affects neither the number of
195
+        # iterations, nor the values presented in `arg`.
196
+        shift                   # remove old arg
197
+        set -- "$@" "$arg"      # push replacement arg
198
+    done
199
+fi
200
+
201
+
202
+# Add default JVM options here. You can also use JAVA_OPTS and KATA_OPTS to pass JVM options to this script.
203
+DEFAULT_JVM_OPTS=""
204
+
205
+# Collect all arguments for the java command:
206
+#   * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207
+#     and any embedded shellness will be escaped.
208
+#   * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209
+#     treated as '${Hostname}' itself on the command line.
210
+
211
+set -- \
212
+        -classpath "$CLASSPATH" \
213
+        re.forestier.edu.Main \
214
+        "$@"
215
+
216
+# Stop when "xargs" is not available.
217
+if ! command -v xargs >/dev/null 2>&1
218
+then
219
+    die "xargs is not available"
220
+fi
221
+
222
+# Use "xargs" to parse quoted args.
223
+#
224
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
225
+#
226
+# In Bash we could simply go:
227
+#
228
+#   readarray ARGS < <( xargs -n1 <<<"$var" ) &&
229
+#   set -- "${ARGS[@]}" "$@"
230
+#
231
+# but POSIX shell has neither arrays nor command substitution, so instead we
232
+# post-process each arg (as a line of input to sed) to backslash-escape any
233
+# character that might be a shell metacharacter, then use eval to reverse
234
+# that process (while maintaining the separation between arguments), and wrap
235
+# the whole thing up as a single "set" statement.
236
+#
237
+# This will of course break if any of these variables contains a newline or
238
+# an unmatched quote.
239
+#
240
+
241
+eval "set -- $(
242
+        printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $KATA_OPTS" |
243
+        xargs -n1 |
244
+        sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
245
+        tr '\n' ' '
246
+    )" '"$@"'
247
+
248
+exec "$JAVACMD" "$@"
... ...
@@ -0,0 +1,92 @@
1
+@rem
2
+@rem Copyright 2015 the original author or authors.
3
+@rem
4
+@rem Licensed under the Apache License, Version 2.0 (the "License");
5
+@rem you may not use this file except in compliance with the License.
6
+@rem You may obtain a copy of the License at
7
+@rem
8
+@rem      https://www.apache.org/licenses/LICENSE-2.0
9
+@rem
10
+@rem Unless required by applicable law or agreed to in writing, software
11
+@rem distributed under the License is distributed on an "AS IS" BASIS,
12
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+@rem See the License for the specific language governing permissions and
14
+@rem limitations under the License.
15
+@rem
16
+
17
+@if "%DEBUG%"=="" @echo off
18
+@rem ##########################################################################
19
+@rem
20
+@rem  kata startup script for Windows
21
+@rem
22
+@rem ##########################################################################
23
+
24
+@rem Set local scope for the variables with windows NT shell
25
+if "%OS%"=="Windows_NT" setlocal
26
+
27
+set DIRNAME=%~dp0
28
+if "%DIRNAME%"=="" set DIRNAME=.
29
+@rem This is normally unused
30
+set APP_BASE_NAME=%~n0
31
+set APP_HOME=%DIRNAME%..
32
+
33
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
34
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35
+
36
+@rem Add default JVM options here. You can also use JAVA_OPTS and KATA_OPTS to pass JVM options to this script.
37
+set DEFAULT_JVM_OPTS=
38
+
39
+@rem Find java.exe
40
+if defined JAVA_HOME goto findJavaFromJavaHome
41
+
42
+set JAVA_EXE=java.exe
43
+%JAVA_EXE% -version >NUL 2>&1
44
+if %ERRORLEVEL% equ 0 goto execute
45
+
46
+echo. 1>&2
47
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48
+echo. 1>&2
49
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50
+echo location of your Java installation. 1>&2
51
+
52
+goto fail
53
+
54
+:findJavaFromJavaHome
55
+set JAVA_HOME=%JAVA_HOME:"=%
56
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57
+
58
+if exist "%JAVA_EXE%" goto execute
59
+
60
+echo. 1>&2
61
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62
+echo. 1>&2
63
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64
+echo location of your Java installation. 1>&2
65
+
66
+goto fail
67
+
68
+:execute
69
+@rem Setup the command line
70
+
71
+set CLASSPATH=%APP_HOME%\lib\kata-1.0-SNAPSHOT.jar;%APP_HOME%\lib\hamcrest-2.2.jar;%APP_HOME%\lib\freemarker-2.3.30.jar
72
+
73
+
74
+@rem Execute kata
75
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %KATA_OPTS%  -classpath "%CLASSPATH%" re.forestier.edu.Main %*
76
+
77
+:end
78
+@rem End local scope for the variables with windows NT shell
79
+if %ERRORLEVEL% equ 0 goto mainEnd
80
+
81
+:fail
82
+rem Set variable KATA_EXIT_CONSOLE if you need the _script_ return code instead of
83
+rem the _cmd.exe /c_ return code!
84
+set EXIT_CODE=%ERRORLEVEL%
85
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
86
+if not ""=="%KATA_EXIT_CONSOLE%" exit %EXIT_CODE%
87
+exit /b %EXIT_CODE%
88
+
89
+:mainEnd
90
+if "%OS%"=="Windows_NT" endlocal
91
+
92
+:omega
... ...
@@ -1,7 +1,7 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<testsuite name="re.forestier.edu.GlobalTest" tests="1" skipped="0" failures="0" errors="0" timestamp="2024-10-24T15:41:14" hostname="a206pc27L.local.isima.fr" time="0.173">
2
+<testsuite name="re.forestier.edu.GlobalTest" tests="1" skipped="0" failures="0" errors="0" timestamp="2024-11-27T14:31:35" hostname="ada.local.isima.fr" time="0.169">
3 3
   <properties/>
4
-  <testcase name="testAffichageBase()" classname="re.forestier.edu.GlobalTest" time="0.173"/>
4
+  <testcase name="testAffichageBase()" classname="re.forestier.edu.GlobalTest" time="0.169"/>
5 5
   <system-out><![CDATA[]]></system-out>
6 6
   <system-err><![CDATA[]]></system-err>
7 7
 </testsuite>
... ...
@@ -1,15 +1,15 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<testsuite name="re.forestier.edu.UnitTests" tests="10" skipped="0" failures="0" errors="0" timestamp="2024-10-24T15:41:14" hostname="a206pc27L.local.isima.fr" time="0.022">
2
+<testsuite name="re.forestier.edu.UnitTests" tests="10" skipped="0" failures="0" errors="0" timestamp="2024-11-27T14:31:35" hostname="ada.local.isima.fr" time="0.029">
3 3
   <properties/>
4 4
   <testcase name="Main" classname="re.forestier.edu.UnitTests" time="0.005"/>
5
-  <testcase name="removeMoney" classname="re.forestier.edu.UnitTests" time="0.004"/>
6
-  <testcase name="ex &amp; lvl" classname="re.forestier.edu.UnitTests" time="0.002"/>
7
-  <testcase name="addMoney" classname="re.forestier.edu.UnitTests" time="0.001"/>
5
+  <testcase name="removeMoney" classname="re.forestier.edu.UnitTests" time="0.006"/>
6
+  <testcase name="ex &amp; lvl" classname="re.forestier.edu.UnitTests" time="0.003"/>
7
+  <testcase name="addMoney" classname="re.forestier.edu.UnitTests" time="0.0"/>
8 8
   <testcase name="Heal and hurt" classname="re.forestier.edu.UnitTests" time="0.001"/>
9
-  <testcase name="Construcor UpdatePlayer" classname="re.forestier.edu.UnitTests" time="0.0"/>
10
-  <testcase name="majDeFinDeTour" classname="re.forestier.edu.UnitTests" time="0.001"/>
11
-  <testcase name="Constructor Player" classname="re.forestier.edu.UnitTests" time="0.0"/>
12
-  <testcase name="Natural Tests" classname="re.forestier.edu.UnitTests" time="0.001"/>
9
+  <testcase name="Construcor UpdatePlayer" classname="re.forestier.edu.UnitTests" time="0.001"/>
10
+  <testcase name="majDeFinDeTour" classname="re.forestier.edu.UnitTests" time="0.003"/>
11
+  <testcase name="Constructor Player" classname="re.forestier.edu.UnitTests" time="0.001"/>
12
+  <testcase name="Natural Tests" classname="re.forestier.edu.UnitTests" time="0.002"/>
13 13
   <testcase name="Sample test" classname="re.forestier.edu.UnitTests" time="0.0"/>
14 14
   <system-out><![CDATA[]]></system-out>
15 15
   <system-err><![CDATA[]]></system-err>
... ...
@@ -2,12 +2,13 @@ package re.forestier.edu;
2 2
 import re.forestier.edu.rpg.Affichage;
3 3
 import re.forestier.edu.rpg.UpdatePlayer;
4 4
 import re.forestier.edu.rpg.Player;
5
+import re.forestier.edu.rpg.Jobs;
5 6
 
6 7
 import java.util.ArrayList;
7 8
 
8 9
 public class Main {
9 10
     public static void main(String[] args) {
10
-        Player firstPlayer = new Player("Florian", "Ruzberg de Rivehaute", "DWARF", 200, new ArrayList<>());
11
+        Player firstPlayer = new Player("Florian", "Ruzberg de Rivehaute", Jobs.DWARF, 200, new ArrayList<>());
11 12
         firstPlayer.addMoney(400);
12 13
 
13 14
         firstPlayer.addXp(15);
... ...
@@ -1,3 +1,20 @@
1 1
 package re.forestier.edu.rpg;
2 2
 
3
-public enum Ability{INT,DEF,ATK,CHA,ALC,VIS};
4 3
\ No newline at end of file
4
+public enum Ability{
5
+    ALC("ALC"),
6
+    ATK("ATK"),
7
+    CHA("CHA"),
8
+    DEF("DEF"),
9
+    INT("INT"),
10
+    VIS("VIS");
11
+
12
+    private final String name;
13
+    private Ability(String name) {
14
+        this.name = name;
15
+    }
16
+
17
+    public String toString()
18
+    {
19
+        return this.name;
20
+    }     
21
+};
5 22
\ No newline at end of file
... ...
@@ -5,5 +5,6 @@ import java.util.HashMap;
5 5
 public interface Job
6 6
 {
7 7
     public static final int maxLevel = 5;
8
+    public String name = "";
8 9
     public HashMap<Ability, Integer[]> abilityPerLevel = new HashMap<Ability,Integer[]>();
9 10
 }
10 11
\ No newline at end of file
... ...
@@ -8,35 +8,47 @@ public enum Jobs implements Job
8 8
 {
9 9
     ADVENTURER
10 10
     { 
11
-        public HashMap<Ability, Integer[]> abilityPerLevel = new HashMap(Map.ofEntries(
12
-            entry(Ability.INT, new Integer[]{1,2,2,2,2}),
13
-            entry(Ability.DEF, new Integer[]{1,1,1,3,4}),
11
+        public String name = "ADVENTURER";
12
+        public HashMap<Ability, Integer[]> getAbilityPerLevel(){ 
13
+            return new HashMap(Map.ofEntries(
14
+            entry(Ability.ALC, new Integer[]{0,0,1,1,1}),
14 15
             entry(Ability.ATK, new Integer[]{3,3,5,5,5}),
15 16
             entry(Ability.CHA, new Integer[]{2,3,3,3,3}),
16
-            entry(Ability.ALC, new Integer[]{1,2,2,2,2}),
17
+            entry(Ability.DEF, new Integer[]{1,1,1,3,4}),
18
+            entry(Ability.INT, new Integer[]{1,2,2,2,2}),
17 19
             entry(Ability.VIS, new Integer[]{0,0,0,0,1})
18 20
         ));
21
+        } 
19 22
     },
20 23
     ARCHER
21 24
     {
22
-        public HashMap<Ability, Integer[]> abilityPerLevel = new HashMap(Map.ofEntries(
23
-            entry(Ability.INT, new Integer[]{1,1,1,1,1}),
24
-            entry(Ability.DEF, new Integer[]{0,1,1,2,2}),
25
+        public String name = "ARCHER";
26
+        public HashMap<Ability, Integer[]> getAbilityPerLevel(){
27
+            return new HashMap(Map.ofEntries(
28
+            entry(Ability.ALC, new Integer[]{0,0,0,0,0}),
25 29
             entry(Ability.ATK, new Integer[]{3,3,3,3,4}),
26 30
             entry(Ability.CHA, new Integer[]{1,2,2,2,2}),
27
-            entry(Ability.ALC, new Integer[]{0,0,0,0,0}),
31
+            entry(Ability.DEF, new Integer[]{0,1,1,2,2}),
32
+            entry(Ability.INT, new Integer[]{1,1,1,1,1}),
28 33
             entry(Ability.VIS, new Integer[]{3,3,3,3,3})
29 34
         ));
35
+        } 
30 36
     },
31 37
     DWARF
32 38
     {
33
-        public HashMap<Ability, Integer[]> abilityPerLevel = new HashMap(Map.ofEntries(
34
-            entry(Ability.INT, new Integer[]{1,1,1,1,1}),
35
-            entry(Ability.DEF, new Integer[]{0,1,1,2,2}),
39
+        public String name = "DWARF";
40
+        public HashMap<Ability, Integer[]> getAbilityPerLevel(){
41
+            return new HashMap(Map.ofEntries(
42
+            entry(Ability.ALC, new Integer[]{4,4,5,5,5}),
36 43
             entry(Ability.ATK, new Integer[]{3,3,4,4,4}),
37 44
             entry(Ability.CHA, new Integer[]{0,0,0,0,1}),
38
-            entry(Ability.ALC, new Integer[]{4,4,5,5,5}),
45
+            entry(Ability.DEF, new Integer[]{0,1,1,2,2}),
46
+            entry(Ability.INT, new Integer[]{1,1,1,1,1}),
39 47
             entry(Ability.VIS, new Integer[]{0,0,0,0,0})
40 48
         ));
41 49
         }
50
+    };
51
+
52
+
53
+    public abstract HashMap<Ability, Integer[]> getAbilityPerLevel();
42 54
 }
43 55
\ No newline at end of file
... ...
@@ -3,6 +3,7 @@ package re.forestier.edu.rpg;
3 3
 import java.util.Random;
4 4
 import java.util.ArrayList;
5 5
 import java.util.HashMap;
6
+import java.util.Collections;
6 7
 import re.forestier.edu.lib.Natural;
7 8
 
8 9
 public class Player {
... ...
@@ -12,7 +13,8 @@ public class Player {
12 13
 
13 14
     private String playerName;
14 15
     private String avatarName;
15
-    private String avatarClass;
16
+    //private String avatarClass;
17
+    public Jobs avatarClass;
16 18
 
17 19
     private Natural money;
18 20
 
... ...
@@ -21,25 +23,21 @@ public class Player {
21 23
     private Natural currentHealthPoints;
22 24
     private Natural xp;
23 25
 
24
-    public HashMap<String, Integer> abilities; //Ability = stat
26
+    public HashMap<Ability, Integer> abilities; //Ability = stat
25 27
     public ArrayList<String> inventory;
26 28
 
27
-    public Player(String playerName, String avatar_name, String avatarClass, int money, ArrayList<String> inventory) {
29
+    public Player(String playerName, String avatar_name, Jobs avatarClass, int money, ArrayList<String> inventory) {
28 30
         this(playerName,avatar_name,avatarClass,money,inventory,Player.defaultMaxHp.toInt());
29 31
     }
30 32
 
31 33
     private Player()
32 34
     {
33 35
         //Here to prevent the compilator to create default constructor
36
+        //TODO throw exception
34 37
     }
35 38
 
36
-    public Player(String playerName, String avatar_name, String avatarClass, int money, ArrayList<String> inventory, int maxHp)
39
+    public Player(String playerName, String avatar_name, Jobs avatarClass, int money, ArrayList<String> inventory, int maxHp)
37 40
     {
38
-        if (!avatarClass.equals("ARCHER") && !avatarClass.equals("ADVENTURER") && !avatarClass.equals("DWARF")) 
39
-        {
40
-            return;
41
-        }
42
-
43 41
         this.playerName = playerName;
44 42
         this.avatarName = avatar_name;
45 43
         this.avatarClass = avatarClass;
... ...
@@ -47,7 +45,11 @@ public class Player {
47 45
         this.inventory = inventory;
48 46
         this.level = Natural.valueOf(1);
49 47
         this.xp = Natural.valueOf(0);
50
-        this.abilities = UpdatePlayer.abilitiesPerTypeAndLevel().get(this.avatarClass).get(1);
48
+        this.abilities = new HashMap<Ability, Integer>();
49
+        avatarClass.getAbilityPerLevel().forEach((ability,value)->
50
+            {this.abilities.put(ability,value[0]);}
51
+        );
52
+
51 53
         this.maxHealthPoint = Natural.valueOf(maxHp);
52 54
         this.currentHealthPoints = Natural.valueOf(maxHp);
53 55
     }
... ...
@@ -110,7 +112,7 @@ public class Player {
110 112
         return this.xp.toInt();
111 113
     }
112 114
 
113
-    public String getAvatarClass () {
115
+    public Jobs getAvatarClass () {
114 116
         return this.avatarClass;
115 117
     }
116 118
 
... ...
@@ -128,15 +130,13 @@ public class Player {
128 130
         if (!ancientLevel.equals(this.level)) {
129 131
             // Player leveled-up!
130 132
             // Give a random object
131
-            ;
132 133
             Random random = new Random();
133 134
             this.inventory.add(UpdatePlayer.objectList[random.nextInt(UpdatePlayer.objectList.length)]);
134 135
 
135 136
             // Add/upgrade abilities to player
136
-            HashMap<String, Integer> abilities = UpdatePlayer.abilitiesPerTypeAndLevel().get(this.getAvatarClass()).get(this.level.toInt());
137
-            abilities.forEach((ability, level) -> {
138
-                this.abilities.put(ability, abilities.get(ability));
139
-            });
137
+            avatarClass.getAbilityPerLevel().forEach((ability,value)->
138
+                {this.abilities.put(ability,value[this.level.toInt()-1]);}
139
+            );
140 140
         }
141 141
     }
142 142
 
... ...
@@ -167,9 +167,23 @@ public class Player {
167 167
         sb.append(" (XP totale : ");
168 168
         sb.append(this.xp);
169 169
         sb.append(")\n\nCapacités :");
170
-        this.abilities.forEach((name, level) -> {
171
-            sb.append("\n   " + name + " : " + level);
172
-        });
170
+
171
+        ArrayList<Ability> abilitiesKey = new ArrayList<Ability>(this.abilities.keySet());
172
+        Collections.sort(abilitiesKey);
173
+        for(Ability a : abilitiesKey)
174
+        {
175
+            if(this.abilities.get(a) != 0)
176
+            {
177
+                sb.append("\n   " + a.toString() + " : " + this.abilities.get(a));
178
+            } 
179
+        } 
180
+
181
+        /*this.abilities.forEach((ability, level) -> {
182
+            if(level != 0)
183
+            {
184
+                sb.append("\n   " + ability.toString() + " : " + level);
185
+            } 
186
+        });*/
173 187
         sb.append("\n\nInventaire :");
174 188
         this.inventory.forEach(item -> {
175 189
             sb.append("\n   " + item);
... ...
@@ -8,96 +8,6 @@ public class UpdatePlayer {
8 8
     public final static String[] objectList = {"Magic bow : Heal by 1/8th of your HP","Lookout Ring : Prevents surprise attacks","Scroll of Stupidity : INT-2 when applied to an enemy", "Draupnir : Increases XP gained by 100%", "Magic Charm : Magic +10 for 5 rounds", "Rune Staff of Curse : May burn your ennemies... Or yourself. Who knows?", "Combat Edge : Well, that's an edge", "Holy Elixir : Recover your HP"
9 9
     };
10 10
 
11
-    public static HashMap<String, HashMap<Integer, HashMap<String, Integer>>> abilitiesPerTypeAndLevel() {
12
-        HashMap<String, HashMap<Integer, HashMap<String, Integer>>> abilitiesPerTypeAndLevel = new HashMap<>();
13
-
14
-        HashMap<Integer, HashMap<String, Integer>> adventurerMap = new HashMap<>();
15
-        HashMap<String, Integer> adventurerLevel1 = new HashMap<>();
16
-        adventurerLevel1.put("INT", 1);
17
-        adventurerLevel1.put("DEF", 1);
18
-        adventurerLevel1.put("ATK", 3);
19
-        adventurerLevel1.put("CHA", 2);
20
-        adventurerMap.put(1, adventurerLevel1);
21
-
22
-        HashMap<String, Integer> adventurerLevel2 = new HashMap<>();
23
-        adventurerLevel1.put("INT", 2);
24
-        adventurerLevel1.put("CHA", 3);
25
-        adventurerMap.put(2, adventurerLevel2);
26
-
27
-        HashMap<String, Integer> adventurerLevel3 = new HashMap<>();
28
-        adventurerLevel3.put("ATK", 5);
29
-        adventurerLevel3.put("ALC", 1);
30
-        adventurerMap.put(3, adventurerLevel3);
31
-
32
-        HashMap<String, Integer> adventurerLevel4 = new HashMap<>();
33
-        adventurerLevel4.put("DEF", 3);
34
-        adventurerMap.put(4, adventurerLevel4);
35
-
36
-        HashMap<String, Integer> adventurerLevel5 = new HashMap<>();
37
-        adventurerLevel5.put("VIS", 1);
38
-        adventurerLevel5.put("DEF", 4);
39
-        adventurerMap.put(5, adventurerLevel5);
40
-
41
-        abilitiesPerTypeAndLevel.put("ADVENTURER", adventurerMap);
42
-
43
-
44
-        HashMap<Integer, HashMap<String, Integer>> archerMap = new HashMap<>();
45
-        HashMap<String, Integer> archerLevel1 = new HashMap<>();
46
-        archerLevel1.put("INT", 1);
47
-        archerLevel1.put("ATK", 3);
48
-        archerLevel1.put("CHA", 1);
49
-        archerLevel1.put("VIS", 3);
50
-        archerMap.put(1, archerLevel1);
51
-
52
-        HashMap<String, Integer> archerLevel2 = new HashMap<>();
53
-        archerLevel2.put("DEF", 1);
54
-        archerLevel2.put("CHA", 2);
55
-        archerMap.put(2, archerLevel2);
56
-
57
-        HashMap<String, Integer> archerLevel3 = new HashMap<>();
58
-        archerLevel3.put("ATK", 3);
59
-        archerMap.put(3, archerLevel3);
60
-
61
-        HashMap<String, Integer> archerLevel4 = new HashMap<>();
62
-        archerLevel4.put("DEF", 2);
63
-        archerMap.put(4, archerLevel4);
64
-
65
-        HashMap<String, Integer> archerLevel5 = new HashMap<>();
66
-        archerLevel5.put("ATK", 4);
67
-        archerMap.put(5, archerLevel5);
68
-
69
-        abilitiesPerTypeAndLevel.put("ARCHER", archerMap);
70
-
71
-
72
-        HashMap<Integer, HashMap<String, Integer>> dwarf = new HashMap<>();
73
-        HashMap<String, Integer> dwarfLevel1 = new HashMap<>();
74
-        dwarfLevel1.put("ALC", 4);
75
-        dwarfLevel1.put("INT", 1);
76
-        dwarfLevel1.put("ATK", 3);
77
-        dwarf.put(1, dwarfLevel1);
78
-
79
-        HashMap<String, Integer> dwarfLevel2 = new HashMap<>();
80
-        dwarfLevel2.put("DEF", 1);
81
-        dwarfLevel2.put("ALC", 5);
82
-        dwarf.put(2, dwarfLevel2);
83
-
84
-        HashMap<String, Integer> dwarfLevel3 = new HashMap<>();
85
-        dwarfLevel3.put("ATK", 4);
86
-        dwarf.put(3, dwarfLevel3);
87
-
88
-        HashMap<String, Integer> dwarfLevel4 = new HashMap<>();
89
-        dwarfLevel4.put("DEF", 2);
90
-        dwarf.put(4, dwarfLevel4);
91
-
92
-        HashMap<String, Integer> dwarfLevel5 = new HashMap<>();
93
-        dwarfLevel5.put("CHA", 1);
94
-        dwarf.put(5, dwarfLevel5);
95
-
96
-        abilitiesPerTypeAndLevel.put("DWARF", dwarf);
97
-
98
-        return abilitiesPerTypeAndLevel;
99
-    }
100
-
101 11
     // majFinDeTour met à jour les points de vie
102 12
     public static void majFinDeTour(Player player) {
103 13
         if(player.getCurrentHealthPoints() == 0) {
... ...
@@ -108,19 +18,19 @@ public class UpdatePlayer {
108 18
         if(player.getCurrentHealthPoints() < player.getMaxHealthPoints()/2) {
109 19
             switch(player.getAvatarClass())
110 20
             {
111
-                case "ADVENTURER" :
21
+                case ADVENTURER :
112 22
                     player.heal(2);
113 23
                     if(player.getLevel() < 3) {
114 24
                         player.hurt(1);
115 25
                     }
116 26
                     break;
117
-                case "DWARF" :
27
+                case DWARF :
118 28
                     player.heal(1);
119 29
                     if(player.inventory.contains("Holy Elixir")) {
120 30
                         player.heal(1);
121 31
                     }
122 32
                     break;
123
-                case "ARCHER" :
33
+                case ARCHER :
124 34
                     player.heal(1);
125 35
                     if(player.inventory.contains("Magic Bow")) {
126 36
                         int potentialHeal = player.getCurrentHealthPoints()/8-1;
... ...
@@ -5,6 +5,7 @@ import org.junit.jupiter.api.Test;
5 5
 import re.forestier.edu.rpg.Affichage;
6 6
 import re.forestier.edu.rpg.UpdatePlayer;
7 7
 import re.forestier.edu.rpg.Player;
8
+import re.forestier.edu.rpg.Jobs;
8 9
 
9 10
 import java.util.ArrayList;
10 11
 
... ...
@@ -44,7 +45,7 @@ public class GlobalTest {
44 45
 
45 46
     @Test
46 47
     void testAffichageBase() {
47
-        Player player = new Player("Florian", "Gnognak le Barbare", "ADVENTURER", 200, new ArrayList<>());
48
+        Player player = new Player("Florian", "Gnognak le Barbare", Jobs.ADVENTURER, 200, new ArrayList<>());
48 49
         player.addXp(20);
49 50
         player.inventory = new ArrayList<>();
50 51
         Affichage.afficherJoueur(player);
... ...
@@ -2,9 +2,9 @@ Joueur Gnognak le Barbare joué par Florian
2 2
 Niveau : 2 (XP totale : 20)
3 3
 
4 4
 Capacités :
5
-   DEF : 1
6 5
    ATK : 3
7 6
    CHA : 3
7
+   DEF : 1
8 8
    INT : 2
9 9
 
10 10
 Inventaire :
11 11
\ No newline at end of file
... ...
@@ -2,6 +2,7 @@ package re.forestier.edu;
2 2
 
3 3
 import org.junit.jupiter.api.*;
4 4
 import re.forestier.edu.rpg.*;
5
+import java.util.HashMap;
5 6
 import java.io.PrintStream;
6 7
 import re.forestier.edu.lib.*;
7 8
 import java.io.ByteArrayOutputStream;
... ...
@@ -36,7 +38,7 @@ public class UnitTests {
36 38
     @Test
37 39
     @DisplayName("Sample test")
38 40
     void testPlayerName() {
39
-        Player Player = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
41
+        Player Player = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>());
40 42
         assertThat(Player.getPlayerName(), is("Florian"));
41 43
         
42 44
     }
... ...
@@ -45,13 +47,11 @@ public class UnitTests {
45 47
     @DisplayName("Constructor Player")
46 48
     void testPlayerConstructor()
47 49
     {
48
-        Player p = new Player("Florian", "Grognak le barbare", "jgn", 100, new ArrayList<>());
49
-        assertThat(p.getPlayerName(), not("Florian"));
50
-        p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
50
+        Player p = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>());
51 51
         assertThat(p.getPlayerName(), is("Florian"));
52
-        p = new Player("Florian", "Grognak le barbare", "DWARF", 100, new ArrayList<>());
52
+        p = new Player("Florian", "Grognak le barbare", Jobs.DWARF, 100, new ArrayList<>());
53 53
         assertThat(p.getPlayerName(), is("Florian"));
54
-        p = new Player("Florian", "Grognak le barbare", "ARCHER", 100, new ArrayList<>());
54
+        p = new Player("Florian", "Grognak le barbare", Jobs.ARCHER, 100, new ArrayList<>());
55 55
         assertThat(p.getPlayerName(), is("Florian"));
56 56
         assertThat(p.getAvatarName(), is("Grognak le barbare"));
57 57
     }
... ...
@@ -59,7 +59,7 @@ public class UnitTests {
59 59
     @Test
60 60
     @DisplayName("removeMoney")
61 61
     void testRemoveMoney() {
62
-        Player p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
62
+        Player p = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>());
63 63
 
64 64
         assertThrows(IllegalArgumentException.class, () -> p.removeMoney(200));
65 65
         p.removeMoney(50);
... ...
@@ -73,7 +73,7 @@ public class UnitTests {
73 73
     @DisplayName("Heal and hurt")
74 74
     void testHealAndHurt()
75 75
     {
76
-        Player p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
76
+        Player p = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>());
77 77
         assertThrows(IllegalArgumentException.class, () -> p.heal(-1));
78 78
         assertThrows(IllegalArgumentException.class, () -> p.hurt(-1));
79 79
 
... ...
@@ -83,7 +83,7 @@ public class UnitTests {
83 83
     @Test
84 84
     @DisplayName("addMoney")
85 85
     void testAddMoney() {
86
-        Player p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
86
+        Player p = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>());
87 87
         p.addMoney(50);
88 88
         assertThat(p.getMoney(), is(150));
89 89
     }
... ...
@@ -98,7 +98,7 @@ public class UnitTests {
98 98
     @Test
99 99
     @DisplayName("ex & lvl")
100 100
     void testRetrieveLevel() {
101
-        Player p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
101
+        Player p = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>());
102 102
         boolean b;
103 103
         p.addXp(5);
104 104
         assertThat(p.getXp(),is(5));
... ...
@@ -112,10 +112,12 @@ public class UnitTests {
112 112
         p.addXp(100);
113 113
         assertThat(p.getLevel(),is(5));
114 114
 
115
-        p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>());
115
+        p = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>());
116 116
         int tailleinv = p.inventory.size();
117 117
         p.addXp(10);
118
-        int atk = p.abilities.get("ATK");
118
+        /*fail(p.avatarClass.getAbilityPerLevel().toString());
119
+        fail(p.abilities.toString());*/
120
+        int atk = p.abilities.get(Ability.ATK);
119 121
         assertNotEquals(p.inventory.size(),tailleinv);
120 122
         assertThat(p.getLevel(),is(2));
121 123
         p.addXp(17);
... ...
@@ -125,13 +127,14 @@ public class UnitTests {
125 127
         p.addXp(54);
126 128
         assertThat(p.getLevel(),is(5));
127 129
         p.addXp(1);
128
-        assertNotEquals(p.abilities.get("ATK"),atk);
130
+        assertNotEquals(p.abilities.get(Ability.ATK),atk);
129 131
     }
130 132
 
131 133
     @Test
132 134
     @DisplayName("majDeFinDeTour")
133 135
     void testMajFinTour() {
134
-        Player p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>(),10);
136
+        assertEquals(Ability.ATK.toString(),"ATK");
137
+        Player p = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>(),10);
135 138
         p.hurt(10);
136 139
         UpdatePlayer.majFinDeTour(p);
137 140
         assertEquals("Le joueur est KO !", outContent.toString().trim());
... ...
@@ -147,45 +150,45 @@ public class UnitTests {
147 150
         UpdatePlayer.majFinDeTour(p);
148 151
         assertThat(p.getCurrentHealthPoints(),is(p.getMaxHealthPoints()));
149 152
         
150
-        p = new Player("Florian", "Grognak le barbare", "DWARF", 100, new ArrayList<>(),10);
153
+        p = new Player("Florian", "Grognak le barbare", Jobs.DWARF, 100, new ArrayList<>(),10);
151 154
         p.hurt(9);
152 155
         UpdatePlayer.majFinDeTour(p);
153 156
         assertThat(p.getCurrentHealthPoints(),is(2));
154 157
 
155
-        p = new Player("Florian", "Grognak le barbare", "DWARF", 100, new ArrayList<>(),10);
158
+        p = new Player("Florian", "Grognak le barbare", Jobs.DWARF, 100, new ArrayList<>(),10);
156 159
         p.hurt(5);
157 160
         UpdatePlayer.majFinDeTour(p);
158 161
         assertThat(p.getCurrentHealthPoints(),is(5));
159 162
 
160 163
         ArrayList<String> inv = new ArrayList<String>();
161 164
         inv.add("Holy Elixir");
162
-        p = new Player("Florian", "Grognak le barbare", "DWARF", 100, inv,10);
165
+        p = new Player("Florian", "Grognak le barbare", Jobs.DWARF, 100, inv,10);
163 166
         p.hurt(9);
164 167
         UpdatePlayer.majFinDeTour(p);
165 168
         assertThat(p.getCurrentHealthPoints(),is(3));
166 169
 
167
-        p = new Player("Florian", "Grognak le barbare", "ARCHER", 100, new ArrayList<>(),10);
170
+        p = new Player("Florian", "Grognak le barbare", Jobs.ARCHER, 100, new ArrayList<>(),10);
168 171
         p.hurt(9);
169 172
         UpdatePlayer.majFinDeTour(p);
170 173
         assertThat(p.getCurrentHealthPoints(),is(2));
171 174
 
172
-        p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>(),10);
175
+        p = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>(),10);
173 176
         p.hurt(9);
174 177
         p.addXp(28);
175 178
         UpdatePlayer.majFinDeTour(p);
176 179
         assertThat(p.getCurrentHealthPoints(),is(3));
177 180
 
178 181
         inv.add("Magic Bow");
179
-        p = new Player("Florian", "Grognak le barbare", "ARCHER", 100, inv,10);
182
+        p = new Player("Florian", "Grognak le barbare", Jobs.ARCHER, 100, inv,10);
180 183
         p.hurt(9);;
181 184
         UpdatePlayer.majFinDeTour(p);
182 185
         assertThat(p.getCurrentHealthPoints(),is(2)); //Suite a discussion avec le client, le "Magic bow" ne peut que soigner
183
-        p = new Player("Florian", "Grognak le barbare", "ARCHER", 100, inv,40);
186
+        p = new Player("Florian", "Grognak le barbare", Jobs.ARCHER, 100, inv,40);
184 187
         p.hurt(24);
185 188
         UpdatePlayer.majFinDeTour(p);
186 189
         assertThat(p.getCurrentHealthPoints(),is(17 + 17/8-1));
187 190
 
188
-        p = new Player("Florian", "Grognak le barbare", "ADVENTURER", 100, new ArrayList<>(),40);
191
+        p = new Player("Florian", "Grognak le barbare", Jobs.ADVENTURER, 100, new ArrayList<>(),40);
189 192
         p.hurt(20);
190 193
         UpdatePlayer.majFinDeTour(p);
191 194
         assertEquals(p.getCurrentHealthPoints(),20);
192 195