mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-18 16:01:42 +00:00
Rename behavior classes
Who are we to say what is regarded as 'Default behavior
This commit is contained in:
parent
2c22c34721
commit
c31a2163dd
@ -2,12 +2,12 @@ package com.gildedrose.behavior;
|
||||
|
||||
import com.gildedrose.behavior.item.ItemBehavior;
|
||||
import com.gildedrose.behavior.item.ItemBehaviorImpl;
|
||||
import com.gildedrose.behavior.quality.DefaultQualityBehavior;
|
||||
import com.gildedrose.behavior.quality.DecreasingQualityBehavior;
|
||||
import com.gildedrose.behavior.quality.ImmutableQualityBehavior;
|
||||
import com.gildedrose.behavior.quality.IncreasingQualityBehavior;
|
||||
import com.gildedrose.behavior.quality.QualityStage;
|
||||
import com.gildedrose.behavior.quality.StagedIncreasingQualityBehavior;
|
||||
import com.gildedrose.behavior.sellin.DefaultSellInBehavior;
|
||||
import com.gildedrose.behavior.sellin.DecreasingSellInBehavior;
|
||||
import com.gildedrose.behavior.sellin.ImmutableSellInBehavior;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -30,7 +30,7 @@ public class ItemBehaviorPicker {
|
||||
}
|
||||
|
||||
private static ItemBehavior getAgedBrieItemBehavior() {
|
||||
return ItemBehaviorImpl.of(IncreasingQualityBehavior.newInstance(), DefaultSellInBehavior.newInstance());
|
||||
return ItemBehaviorImpl.of(IncreasingQualityBehavior.newInstance(), DecreasingSellInBehavior.newInstance());
|
||||
}
|
||||
|
||||
private static ItemBehavior getSulfurusHandOfRagnarosItemBehavior() {
|
||||
@ -39,10 +39,10 @@ public class ItemBehaviorPicker {
|
||||
|
||||
private static ItemBehavior getBackstagePassesItemBehavior() {
|
||||
List<QualityStage> stages = new ArrayList<>(Arrays.asList(QualityStage.of(10,2), QualityStage.of(5,3)));
|
||||
return ItemBehaviorImpl.of(StagedIncreasingQualityBehavior.withStages(stages, 1), DefaultSellInBehavior.newInstance());
|
||||
return ItemBehaviorImpl.of(StagedIncreasingQualityBehavior.withStages(stages, 1), DecreasingSellInBehavior.newInstance());
|
||||
}
|
||||
|
||||
private static ItemBehavior getDefaultItemBehavior() {
|
||||
return ItemBehaviorImpl.of(DefaultQualityBehavior.newInstance(), DefaultSellInBehavior.newInstance());
|
||||
return ItemBehaviorImpl.of(DecreasingQualityBehavior.newInstance(), DecreasingSellInBehavior.newInstance());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,15 +2,15 @@ package com.gildedrose.behavior.quality;
|
||||
|
||||
import com.gildedrose.Item;
|
||||
|
||||
public class DefaultQualityBehavior implements QualityBehavior {
|
||||
public class DecreasingQualityBehavior implements QualityBehavior {
|
||||
|
||||
public static final int MAX_QUALITY_LEVEL = 50;
|
||||
public static final int MIN_QUALITY_LEVEL = 0;
|
||||
public static final int DEFAULT_QUALITY_DECREASE = 1;
|
||||
public static final int FASTER_QUALITY_DECREASE = 2;
|
||||
|
||||
public static DefaultQualityBehavior newInstance() {
|
||||
return new DefaultQualityBehavior();
|
||||
public static DecreasingQualityBehavior newInstance() {
|
||||
return new DecreasingQualityBehavior();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2,10 +2,10 @@ package com.gildedrose.behavior.sellin;
|
||||
|
||||
import com.gildedrose.Item;
|
||||
|
||||
public class DefaultSellInBehavior implements SellInBehavior {
|
||||
public class DecreasingSellInBehavior implements SellInBehavior {
|
||||
|
||||
public static DefaultSellInBehavior newInstance() {
|
||||
return new DefaultSellInBehavior();
|
||||
public static DecreasingSellInBehavior newInstance() {
|
||||
return new DecreasingSellInBehavior();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -6,13 +6,13 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class DefaultQualityBehaviorTest {
|
||||
public class DecreasingQualityBehaviorTest {
|
||||
|
||||
private QualityBehavior qualityBehavior;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
qualityBehavior = new DefaultQualityBehavior();
|
||||
qualityBehavior = new DecreasingQualityBehavior();
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -6,13 +6,13 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class DefaultSellInBehaviorTest {
|
||||
public class DecreasingSellInBehaviorTest {
|
||||
|
||||
private SellInBehavior sellInBehavior;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
sellInBehavior = new DefaultSellInBehavior();
|
||||
sellInBehavior = new DecreasingSellInBehavior();
|
||||
}
|
||||
|
||||
@Test
|
||||
Loading…
Reference in New Issue
Block a user