Created
August 10, 2016 09:47
-
-
Save YDanot/c506dfcd51d93b6e0c3375b566859265 to your computer and use it in GitHub Desktop.
gildedrose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project version="4"> | |
| <component name="CompilerConfiguration"> | |
| <resourceExtensions /> | |
| <wildcardResourcePatterns> | |
| <entry name="!?*.java" /> | |
| <entry name="!?*.form" /> | |
| <entry name="!?*.class" /> | |
| <entry name="!?*.groovy" /> | |
| <entry name="!?*.scala" /> | |
| <entry name="!?*.flex" /> | |
| <entry name="!?*.kt" /> | |
| <entry name="!?*.clj" /> | |
| <entry name="!?*.aj" /> | |
| </wildcardResourcePatterns> | |
| <annotationProcessing> | |
| <profile default="true" name="Default" enabled="false"> | |
| <processorPath useClasspath="true" /> | |
| </profile> | |
| <profile default="false" name="Maven default annotation processors profile" enabled="true"> | |
| <sourceOutputDir name="target/generated-sources/annotations" /> | |
| <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> | |
| <outputRelativeToContentRoot value="true" /> | |
| <processorPath useClasspath="true" /> | |
| <module name="GildedRose" /> | |
| </profile> | |
| </annotationProcessing> | |
| <bytecodeTargetLevel> | |
| <module name="GildedRose" target="1.5" /> | |
| </bytecodeTargetLevel> | |
| </component> | |
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <component name="CopyrightManager"> | |
| <settings default="" /> | |
| </component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <component name="libraryTable"> | |
| <library name="Maven: junit:junit:4.12"> | |
| <CLASSES> | |
| <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" /> | |
| </CLASSES> | |
| <JAVADOC> | |
| <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-javadoc.jar!/" /> | |
| </JAVADOC> | |
| <SOURCES> | |
| <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12-sources.jar!/" /> | |
| </SOURCES> | |
| </library> | |
| </component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <component name="libraryTable"> | |
| <library name="Maven: org.hamcrest:hamcrest-core:1.3"> | |
| <CLASSES> | |
| <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" /> | |
| </CLASSES> | |
| <JAVADOC> | |
| <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" /> | |
| </JAVADOC> | |
| <SOURCES> | |
| <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" /> | |
| </SOURCES> | |
| </library> | |
| </component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project version="4"> | |
| <component name="EntryPointsManager"> | |
| <entry_points version="2.0" /> | |
| </component> | |
| <component name="MavenProjectsManager"> | |
| <option name="originalFiles"> | |
| <list> | |
| <option value="$PROJECT_DIR$/pom.xml" /> | |
| </list> | |
| </option> | |
| </component> | |
| <component name="ProjectLevelVcsManager" settingsEditedManually="false"> | |
| <OptionsSetting value="true" id="Add" /> | |
| <OptionsSetting value="true" id="Remove" /> | |
| <OptionsSetting value="true" id="Checkout" /> | |
| <OptionsSetting value="true" id="Update" /> | |
| <OptionsSetting value="true" id="Status" /> | |
| <OptionsSetting value="true" id="Edit" /> | |
| <ConfirmationsSetting value="0" id="Add" /> | |
| <ConfirmationsSetting value="0" id="Remove" /> | |
| </component> | |
| <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
| <output url="file://$PROJECT_DIR$/out" /> | |
| </component> | |
| <component name="masterDetails"> | |
| <states> | |
| <state key="ProjectJDKs.UI"> | |
| <settings> | |
| <last-edited>1.8</last-edited> | |
| <splitter-proportions> | |
| <option name="proportions"> | |
| <list> | |
| <option value="0.2" /> | |
| </list> | |
| </option> | |
| </splitter-proportions> | |
| </settings> | |
| </state> | |
| </states> | |
| </component> | |
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project version="4"> | |
| <component name="ProjectModuleManager"> | |
| <modules> | |
| <module fileurl="file://$PROJECT_DIR$/GildedRose.iml" filepath="$PROJECT_DIR$/GildedRose.iml" /> | |
| </modules> | |
| </component> | |
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | |
| <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false"> | |
| <output url="file://$MODULE_DIR$/target/classes" /> | |
| <output-test url="file://$MODULE_DIR$/target/test-classes" /> | |
| <content url="file://$MODULE_DIR$"> | |
| <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | |
| <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | |
| <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | |
| <excludeFolder url="file://$MODULE_DIR$/target" /> | |
| </content> | |
| <orderEntry type="inheritedJdk" /> | |
| <orderEntry type="sourceFolder" forTests="false" /> | |
| <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" /> | |
| <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" /> | |
| </component> | |
| </module> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <groupId>ing.kata</groupId> | |
| <artifactId>gilded-rose</artifactId> | |
| <version>1.0-SNAPSHOT</version> | |
| <dependencies> | |
| <dependency> | |
| <groupId>junit</groupId> | |
| <artifactId>junit</artifactId> | |
| <version>RELEASE</version> | |
| <scope>test</scope> | |
| </dependency> | |
| </dependencies> | |
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.gildedrose; | |
| class GildedRose { | |
| Item[] items; | |
| public GildedRose(Item[] items) { | |
| this.items = items; | |
| } | |
| public void updateQuality() { | |
| for (int i = 0; i < items.length; i++) { | |
| if (!items[i].name.equals("Aged Brie") | |
| && !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) { | |
| if (items[i].quality > 0) { | |
| if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { | |
| items[i].quality = items[i].quality - 1; | |
| } | |
| } | |
| } else { | |
| if (items[i].quality < 50) { | |
| items[i].quality = items[i].quality + 1; | |
| if (items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) { | |
| if (items[i].sellIn < 11) { | |
| if (items[i].quality < 50) { | |
| items[i].quality = items[i].quality + 1; | |
| } | |
| } | |
| if (items[i].sellIn < 6) { | |
| if (items[i].quality < 50) { | |
| items[i].quality = items[i].quality + 1; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { | |
| items[i].sellIn = items[i].sellIn - 1; | |
| } | |
| if (items[i].sellIn < 0) { | |
| if (!items[i].name.equals("Aged Brie")) { | |
| if (!items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) { | |
| if (items[i].quality > 0) { | |
| if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { | |
| items[i].quality = items[i].quality - 1; | |
| } | |
| } | |
| } else { | |
| items[i].quality = items[i].quality - items[i].quality; | |
| } | |
| } else { | |
| if (items[i].quality < 50) { | |
| items[i].quality = items[i].quality + 1; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.gildedrose; | |
| public class Item { | |
| public String name; | |
| public int sellIn; | |
| public int quality; | |
| public Item(String name, int sellIn, int quality) { | |
| this.name = name; | |
| this.sellIn = sellIn; | |
| this.quality = quality; | |
| } | |
| @Override | |
| public String toString() { | |
| return this.name + ", " + this.sellIn + ", " + this.quality; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.gildedrose; | |
| public class TexttestFixture { | |
| public static void main(String[] args) { | |
| System.out.println("OMGHAI!"); | |
| Item[] items = new Item[] { | |
| new Item("+5 Dexterity Vest", 10, 20), // | |
| new Item("Aged Brie", 2, 0), // | |
| new Item("Elixir of the Mongoose", 5, 7), // | |
| new Item("Sulfuras, Hand of Ragnaros", 0, 80), // | |
| new Item("Sulfuras, Hand of Ragnaros", -1, 80), | |
| new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20), | |
| new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), | |
| new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), | |
| // this conjured item does not work properly yet | |
| new Item("Conjured Mana Cake", 3, 6) }; | |
| GildedRose app = new GildedRose(items); | |
| int days = 2; | |
| if (args.length > 0) { | |
| days = Integer.parseInt(args[0]) + 1; | |
| } | |
| for (int i = 0; i < days; i++) { | |
| System.out.println("-------- day " + i + " --------"); | |
| System.out.println("name, sellIn, quality"); | |
| for (Item item : items) { | |
| System.out.println(item); | |
| } | |
| System.out.println(); | |
| app.updateQuality(); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.gildedrose; | |
| import org.junit.Test; | |
| import static org.junit.Assert.*; | |
| /** | |
| * Created by yann on 10/08/16. | |
| */ | |
| public class GildedRoseTest { | |
| @Test | |
| public void foo() { | |
| Item[] items = new Item[] { new Item("foo", 0, 0) }; | |
| GildedRose app = new GildedRose(items); | |
| app.updateQuality(); | |
| assertEquals("fixme", app.items[0].name); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment