diff --git a/Java/.editorconfig b/Java/.editorconfig index 2f1b8410..59e0c85a 100644 --- a/Java/.editorconfig +++ b/Java/.editorconfig @@ -1,6 +1,6 @@ [*] charset = utf-8 -indent_size = 4 +indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true diff --git a/Java/build.gradle b/Java/build.gradle index 8be8a631..933b1935 100644 --- a/Java/build.gradle +++ b/Java/build.gradle @@ -1,15 +1,18 @@ plugins { - id 'java' + id 'java' + id "io.freefair.lombok" version "6.5.1" } repositories { - mavenCentral() + mavenCentral() } dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.6.2' - testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.6.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2' + testImplementation 'org.junit.jupiter:junit-jupiter-params:5.6.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.6.2' + testImplementation 'org.assertj:assertj-core:3.23.1' + testImplementation 'org.mockito:mockito-core:4.8.0' } group = 'com.gildedrose' @@ -17,5 +20,5 @@ version = '0.0.1-SNAPSHOT' sourceCompatibility = '1.8' test { - useJUnitPlatform() + useJUnitPlatform() } diff --git a/Java/gradle/wrapper/gradle-wrapper.jar b/Java/gradle/wrapper/gradle-wrapper.jar index cc4fdc29..e708b1c0 100644 Binary files a/Java/gradle/wrapper/gradle-wrapper.jar and b/Java/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Java/gradle/wrapper/gradle-wrapper.properties b/Java/gradle/wrapper/gradle-wrapper.properties index 622ab64a..ae04661e 100644 --- a/Java/gradle/wrapper/gradle-wrapper.properties +++ b/Java/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/Java/gradlew b/Java/gradlew index 2fe81a7d..4f906e0c 100755 --- a/Java/gradlew +++ b/Java/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/Java/gradlew.bat b/Java/gradlew.bat index 9618d8d9..107acd32 100644 --- a/Java/gradlew.bat +++ b/Java/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/Java/requirements.txt b/Java/requirements.txt new file mode 100644 index 00000000..5090a67a --- /dev/null +++ b/Java/requirements.txt @@ -0,0 +1,38 @@ +====================================== +Gilded Rose Requirements Specification +====================================== + +Hi and welcome to team Gilded Rose. As you know, we are a small inn with a prime location in a +prominent city ran by a friendly innkeeper named Allison. We also buy and sell only the finest goods. +Unfortunately, our goods are constantly degrading in quality as they approach their sell by date. We +have a system in place that updates our inventory for us. It was developed by a no-nonsense type named +Leeroy, who has moved on to new adventures. Your task is to add the new feature to our system so that +we can begin selling a new category of items. First an introduction to our system: + + - All items have a SellIn value which denotes the number of days we have to sell the item + - All items have a Quality value which denotes how valuable the item is + - At the end of each day our system lowers both values for every item + +Pretty simple, right? Well this is where it gets interesting: + + - Once the sell by date has passed, Quality degrades twice as fast + - The Quality of an item is never negative + - "Aged Brie" actually increases in Quality the older it gets + - The Quality of an item is never more than 50 + - "Sulfuras", being a legendary item, never has to be sold or decreases in Quality + - "Backstage passes", like aged brie, increases in Quality as its SellIn value approaches; + Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but + Quality drops to 0 after the concert + +We have recently signed a supplier of conjured items. This requires an update to our system: + + - "Conjured" items degrade in Quality twice as fast as normal items + +Feel free to make any changes to the UpdateQuality method and add any new code as long as everything +still works correctly. However, do not alter the Item class or Items property as those belong to the +goblin in the corner who will insta-rage and one-shot you as he doesn't believe in shared code +ownership (you can make the UpdateQuality method and Items property static if you like, we'll cover +for you). + +Just for clarification, an item can never have its Quality increase above 50, however "Sulfuras" is a +legendary item and as such its Quality is 80 and it never alters. \ No newline at end of file