mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 06:21:29 +00:00
get rid of lombok, inline variables
This commit is contained in:
parent
faac704c55
commit
857b6cd474
@ -33,7 +33,7 @@
|
|||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>${lombok.version}</version>
|
<version>${lombok.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.assertj</groupId>
|
<groupId>org.assertj</groupId>
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.gildedrose.rules.DefaultQualityRule;
|
|||||||
import com.gildedrose.rules.QualityRule;
|
import com.gildedrose.rules.QualityRule;
|
||||||
import com.gildedrose.rules.Result;
|
import com.gildedrose.rules.Result;
|
||||||
import com.gildedrose.rules.SulfurasQualityRule;
|
import com.gildedrose.rules.SulfurasQualityRule;
|
||||||
import lombok.val;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -35,21 +34,19 @@ class GildedRose {
|
|||||||
|
|
||||||
private void processItem(final Item item) {
|
private void processItem(final Item item) {
|
||||||
|
|
||||||
val newSellIn = calculateSellIn(item.name, item.sellIn);
|
item.sellIn = calculateSellIn(item.name, item.sellIn);
|
||||||
|
|
||||||
val newQuality = rules.stream()
|
item.quality = rules.stream()
|
||||||
.reduce(new Result(item.quality, false),
|
.reduce(new Result(item.quality, false),
|
||||||
(q, rule) -> {
|
(q, rule) -> {
|
||||||
if (q.isFinalValue() || !rule.shouldApply(item.name)) {
|
if (q.isFinalValue() || !rule.shouldApply(item.name)) {
|
||||||
return q;
|
return q;
|
||||||
} else {
|
} else {
|
||||||
return rule.calculateQuality(q.getQuality(), newSellIn);
|
return rule.calculateQuality(q.getQuality(), item.sellIn);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(a, b) -> b).getQuality();
|
(a, b) -> b).getQuality();
|
||||||
|
|
||||||
item.quality = newQuality;
|
|
||||||
item.sellIn = newSellIn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int calculateSellIn(final String name, final int originalSellIn) {
|
private int calculateSellIn(final String name, final int originalSellIn) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user