Rename behavior classes

Who are we to say what is regarded as 'Default behavior
This commit is contained in:
Bjorn Misseghers 2021-04-13 11:12:26 +02:00
parent 2c22c34721
commit c31a2163dd
5 changed files with 15 additions and 15 deletions

View File

@ -2,12 +2,12 @@ package com.gildedrose.behavior;
import com.gildedrose.behavior.item.ItemBehavior; import com.gildedrose.behavior.item.ItemBehavior;
import com.gildedrose.behavior.item.ItemBehaviorImpl; 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.ImmutableQualityBehavior;
import com.gildedrose.behavior.quality.IncreasingQualityBehavior; import com.gildedrose.behavior.quality.IncreasingQualityBehavior;
import com.gildedrose.behavior.quality.QualityStage; import com.gildedrose.behavior.quality.QualityStage;
import com.gildedrose.behavior.quality.StagedIncreasingQualityBehavior; 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 com.gildedrose.behavior.sellin.ImmutableSellInBehavior;
import java.util.ArrayList; import java.util.ArrayList;
@ -30,7 +30,7 @@ public class ItemBehaviorPicker {
} }
private static ItemBehavior getAgedBrieItemBehavior() { private static ItemBehavior getAgedBrieItemBehavior() {
return ItemBehaviorImpl.of(IncreasingQualityBehavior.newInstance(), DefaultSellInBehavior.newInstance()); return ItemBehaviorImpl.of(IncreasingQualityBehavior.newInstance(), DecreasingSellInBehavior.newInstance());
} }
private static ItemBehavior getSulfurusHandOfRagnarosItemBehavior() { private static ItemBehavior getSulfurusHandOfRagnarosItemBehavior() {
@ -39,10 +39,10 @@ public class ItemBehaviorPicker {
private static ItemBehavior getBackstagePassesItemBehavior() { private static ItemBehavior getBackstagePassesItemBehavior() {
List<QualityStage> stages = new ArrayList<>(Arrays.asList(QualityStage.of(10,2), QualityStage.of(5,3))); 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() { private static ItemBehavior getDefaultItemBehavior() {
return ItemBehaviorImpl.of(DefaultQualityBehavior.newInstance(), DefaultSellInBehavior.newInstance()); return ItemBehaviorImpl.of(DecreasingQualityBehavior.newInstance(), DecreasingSellInBehavior.newInstance());
} }
} }

View File

@ -2,15 +2,15 @@ package com.gildedrose.behavior.quality;
import com.gildedrose.Item; 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 MAX_QUALITY_LEVEL = 50;
public static final int MIN_QUALITY_LEVEL = 0; public static final int MIN_QUALITY_LEVEL = 0;
public static final int DEFAULT_QUALITY_DECREASE = 1; public static final int DEFAULT_QUALITY_DECREASE = 1;
public static final int FASTER_QUALITY_DECREASE = 2; public static final int FASTER_QUALITY_DECREASE = 2;
public static DefaultQualityBehavior newInstance() { public static DecreasingQualityBehavior newInstance() {
return new DefaultQualityBehavior(); return new DecreasingQualityBehavior();
} }
@Override @Override

View File

@ -2,10 +2,10 @@ package com.gildedrose.behavior.sellin;
import com.gildedrose.Item; import com.gildedrose.Item;
public class DefaultSellInBehavior implements SellInBehavior { public class DecreasingSellInBehavior implements SellInBehavior {
public static DefaultSellInBehavior newInstance() { public static DecreasingSellInBehavior newInstance() {
return new DefaultSellInBehavior(); return new DecreasingSellInBehavior();
} }
@Override @Override

View File

@ -6,13 +6,13 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
public class DefaultQualityBehaviorTest { public class DecreasingQualityBehaviorTest {
private QualityBehavior qualityBehavior; private QualityBehavior qualityBehavior;
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {
qualityBehavior = new DefaultQualityBehavior(); qualityBehavior = new DecreasingQualityBehavior();
} }
@Test @Test

View File

@ -6,13 +6,13 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
public class DefaultSellInBehaviorTest { public class DecreasingSellInBehaviorTest {
private SellInBehavior sellInBehavior; private SellInBehavior sellInBehavior;
@BeforeEach @BeforeEach
public void setUp() throws Exception { public void setUp() throws Exception {
sellInBehavior = new DefaultSellInBehavior(); sellInBehavior = new DecreasingSellInBehavior();
} }
@Test @Test