increasing test coverage

This commit is contained in:
villanibe 2025-06-30 01:17:15 +02:00
parent b8bd42e9da
commit 0238cf2fe2

View File

@ -9,7 +9,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
public class InventoryRuleEngineTest {
@Test
void shouldProcessAgedBrieRule() {
void shouldApplyAgedBrieRule() {
//given
ItemAdapter itemAdapter = new ItemAdapter(ItemType.AGEG_BRIE, new Item("Aged Brie", 3, 0));
@ -20,4 +20,46 @@ public class InventoryRuleEngineTest {
assertEquals(2, itemAdapter.getItem().sellIn);
assertEquals(1, itemAdapter.getItem().quality);
}
@Test
void shouldApplySulfurasRule() {
//given
ItemAdapter itemAdapter = new ItemAdapter(ItemType.SULFURAS,
new Item("Sulfuras, Hand of Ragnaros", 3, 80));
//when
InventoryRuleEngine.applyUpdateRule(itemAdapter);
//then
assertEquals(3, itemAdapter.getItem().sellIn);
assertEquals(80, itemAdapter.getItem().quality);
}
@Test
void shouldApplyBackstagePassesRule() {
//given
ItemAdapter itemAdapter = new ItemAdapter(ItemType.BACKSTAGE_PASSES,
new Item("Backstage passes to a TAFKAL80ETC concert", 3, 10));
//when
InventoryRuleEngine.applyUpdateRule(itemAdapter);
//then
assertEquals(2, itemAdapter.getItem().sellIn);
assertEquals(13, itemAdapter.getItem().quality);
}
@Test
void shouldApplyStandardItemRule() {
//given
ItemAdapter itemAdapter = new ItemAdapter(ItemType.STANDARD,
new Item("Elixir of the Mongoose", 5, 7));
//when
InventoryRuleEngine.applyUpdateRule(itemAdapter);
//then
assertEquals(4, itemAdapter.getItem().sellIn);
assertEquals(6, itemAdapter.getItem().quality);
}
}