improve unit tests

This commit is contained in:
Velizar Todorov 2021-11-30 18:05:20 +01:00
parent 32cbb6f2e0
commit 7a609b11f1
3 changed files with 25 additions and 7 deletions

View File

@ -6,8 +6,7 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import static com.gildedrose.helper.TestHelper.testItem;
import static com.gildedrose.helper.TestHelper.testItemException;
import static com.gildedrose.helper.TestHelper.*;
import static com.gildedrose.items.AgedBrieItem.AGED_BRIE;
@TestMethodOrder(OrderAnnotation.class)
@ -15,6 +14,7 @@ class AgedBrieItemTest {
private final Item item = new Item(AGED_BRIE, 5, 20);
private final Item itemError = new Item(AGED_BRIE, 10, -5);
private final Item itemAboveLimitQuality = new Item(AGED_BRIE, 10, 60);
@Test
@Order(1)
@ -34,4 +34,10 @@ class AgedBrieItemTest {
testItemException(itemError);
}
@Test
@Order(4)
void QualityAboveLimitFail() {
testItemQualityAboveLimitException(itemAboveLimitQuality);
}
}

View File

@ -6,8 +6,7 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import static com.gildedrose.helper.TestHelper.testItem;
import static com.gildedrose.helper.TestHelper.testItemException;
import static com.gildedrose.helper.TestHelper.*;
import static com.gildedrose.items.BackstagePassItem.BACKSTAGE_PASS;
@TestMethodOrder(OrderAnnotation.class)
@ -15,6 +14,7 @@ class BackstagePassItemTest {
private final Item item = new Item(BACKSTAGE_PASS, 15, 20);
private final Item itemError = new Item(BACKSTAGE_PASS, 10, -5);
private final Item itemAboveLimitQuality = new Item(BACKSTAGE_PASS, 10, 60);
@Test
@Order(1)
@ -41,9 +41,15 @@ class BackstagePassItemTest {
}
@Test
@Order(2)
@Order(5)
void negativeQualityFail() {
testItemException(itemError);
}
@Test
@Order(6)
void QualityAboveLimitFail() {
testItemQualityAboveLimitException(itemAboveLimitQuality);
}
}

View File

@ -6,8 +6,7 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import static com.gildedrose.helper.TestHelper.testItem;
import static com.gildedrose.helper.TestHelper.testItemException;
import static com.gildedrose.helper.TestHelper.*;
import static com.gildedrose.items.ConjuredItem.CONJURED;
@TestMethodOrder(OrderAnnotation.class)
@ -15,6 +14,7 @@ class ConjuredItemTest {
private final Item item = new Item(CONJURED, 5, 20);
private final Item itemError = new Item(CONJURED, 10, -5);
private final Item itemAboveLimitQuality = new Item(CONJURED, 10, 60);
@Test
@Order(1)
@ -33,4 +33,10 @@ class ConjuredItemTest {
void negativeQualityFail() {
testItemException(itemError);
}
@Test
@Order(4)
void QualityAboveLimitFail() {
testItemQualityAboveLimitException(itemAboveLimitQuality);
}
}