Commit Graph

47 Commits

Author SHA1 Message Date
Bjorn Misseghers
2ba07cce25 Add Conjured mana cake implementation
The quality of the cake decreases twice as fast as the default, so we
pass these levels of quality decay to the quality behavior constructor
2021-04-13 11:27:27 +02:00
Bjorn Misseghers
2b4307cd31 Allow passing of quality decrease numbers via
the constructor

We need to be able to configure other levels of decay. When passing no
parameters, the behavior remains as it was
2021-04-13 11:25:58 +02:00
Bjorn Misseghers
c31a2163dd Rename behavior classes
Who are we to say what is regarded as 'Default behavior
2021-04-13 11:12:26 +02:00
Bjorn Misseghers
2c22c34721 Use the item behaviors to process the updates 2021-04-13 11:06:37 +02:00
Bjorn Misseghers
5f60697105 Add ItemBehaviorPicker
This creates the correct ItemBehavior implementation for the given item
name
2021-04-13 11:04:59 +02:00
Bjorn Misseghers
7435c53775 Add base class for item behavior
The class takes quality and sellIn behavior implementations as
constructor parameters
2021-04-13 10:59:23 +02:00
Bjorn Misseghers
05a3cf148a Remove DefaultItemBehavior impl
We will not create a class for every flavor of behavior possible. We
will compose the behaviors by injecting quality and sellIn behavior in
the constructor
2021-04-13 10:57:49 +02:00
Bjorn Misseghers
f98d6bcaf6 Add static constructor methods for easy-of-use 2021-04-13 10:56:44 +02:00
Bjorn Misseghers
620d48221b Add immutable sellIn behavior
SellIn does not change. Ever.
2021-04-13 10:55:38 +02:00
Bjorn Misseghers
fe94e8b8f7 Add immutable quality behavior
Quality does not change. Ever
2021-04-13 10:55:05 +02:00
Bjorn Misseghers
a7ff7f32cd Add staged quality increase behavior
Depending on the sellIn value, we can have a different rate of quality
increase. There always needs to be a default quality increase defined.
And then we need to define the stages at with the quality increase
changes.
2021-04-13 10:06:21 +02:00
Bjorn Misseghers
e68fab24b4 Add test for increasing negative quality edge case
Quality can never be lower than 0. So increasing a negative quality
should always result in a quality bigger than 0
2021-04-13 10:04:38 +02:00
Bjorn Misseghers
7e3e5d0d7c Implement faster quality decrease after sellIn
Quality decreases by 2 after the sellIn reaches 0
2021-04-13 10:03:27 +02:00
Bjorn Misseghers
e9f47d84b4 Add increasing quality behavior and test 2021-04-13 08:56:01 +02:00
Bjorn Misseghers
45ef8fc2ad Add test for DefaultQualityBehavior 2021-04-13 08:55:09 +02:00
Bjorn Misseghers
84f07913b6 Add test for DefaultSellInBehavior 2021-04-13 08:54:53 +02:00
Bjorn Misseghers
a282a8455e Add Itembehavior interface and default impl.
Again, separating the item behavior into a separate interface allows us
to determine the item behavior by choosing a sellIn and a
qualityBehavior implementation. The defaultItemBehavior uses the default
quality and sellIn behavior
2021-04-13 08:51:46 +02:00
Bjorn Misseghers
11c697d7c5 Separate qyality behavior in separate class
Same reason as for the sellIn behavior. We want to be able to provide
separate implementations and test them separately
2021-04-13 08:50:16 +02:00
Bjorn Misseghers
5f51644a8c Separate sellIn behavior in separate class
We extract this behavior in a separate interface so we can implement
different implementations of it and test them separately.
Default behavior is to decrease the sellIn date every iteration by 1
2021-04-13 08:47:35 +02:00
Bjorn Misseghers
8f6359ad93 Add tests for edge cases 2021-04-06 21:35:30 +02:00
Bjorn Misseghers
d128595952 Simplify equasion 2021-04-06 20:24:59 +02:00
Bjorn Misseghers
f040a5d3fb Extract sellIn decrease into private method 2021-04-06 20:22:31 +02:00
Bjorn Misseghers
2fb5d2bc77 Extract quality inc and decrease into private method 2021-04-06 20:21:13 +02:00
Bjorn Misseghers
8b94d335e8 Dont get item from array every time 2021-04-06 20:14:21 +02:00
Bjorn Misseghers
f1a9242aac Extract magic strings and numbers 2021-04-06 20:10:48 +02:00
Bjorn Misseghers
8a23641287 Add unit tests matching the textTests 2021-04-06 17:28:23 +02:00
Bjorn Misseghers
fced540907 Change parameter name to nrOfDays 2021-04-06 17:28:00 +02:00
Bjorn Misseghers
4a6ed7cac1 Use app tester in unit test 2021-04-06 17:13:35 +02:00
Bjorn Misseghers
bd32cf4692 Create app test util 2021-04-06 17:13:04 +02:00
Bjorn Misseghers
64bdd856ce Fix failing unit test 2021-04-06 16:55:23 +02:00
Lars Eckart
0f729f3192 update gradle wrapper & junit5 dependency 2020-06-04 10:22:28 +03:00
Görge Albrecht
948852c2c4 add gradle build capabilities 2019-11-18 17:42:08 +01:00
Görge Albrecht
eb271c686f migrate to JUnit 5 2019-11-18 17:05:22 +01:00
Ton van Bart
5605173439 reverted GildedRose to original code 2017-01-11 21:32:08 +01:00
Ton van Bart
b2422cf733 delete package with weird name 2017-01-09 22:38:54 +01:00
Ton van Bart
d4b3a30334 delete package with weird name 2017-01-09 22:31:26 +01:00
Ton van Bart
260dc83099 use java.version property in pom.xml 2016-12-01 10:47:47 +01:00
Ton van Bart
40e7ea75c6 fixed directory structure 2016-12-01 09:45:34 +01:00
Ton van Bart
dae358a131 added Eclipse files to .gitignore 2016-12-01 09:37:05 +01:00
Ton van Bart
62b3b2fdb9 added IDEA project files to gitignore, set Maven java version to 8 2016-11-29 12:40:59 +01:00
Ton van Bart
3289182cef reorganized to Maven project structure 2016-11-29 12:36:54 +01:00
Peter Kofler
f492b562df update IDEA settings to IDEA 13 2014-11-28 20:40:52 +01:00
Peter Kofler
16b7b46653 add missing @Override annotation to item's toString 2014-04-13 13:40:22 +02:00
Peter Kofler
f284d7597a add IDEA setup for Java code 2014-01-25 23:01:40 +01:00
Peter Kofler
5920278cf3 add Java Eclipse settings 2014-01-25 23:01:39 +01:00
Peter Kofler
7c817b1032 format Java code (only whitespace changes) 2014-01-25 23:01:39 +01:00
emilybache
567c27854a Removed all the code except for the GildedRose kata from this repo 2013-06-10 14:42:41 +02:00