diff --git a/src/main/java/ch/heigvd/res/chill/domain/djeule2/KadjiBeer.java b/src/main/java/ch/heigvd/res/chill/domain/djeule2/KadjiBeer.java new file mode 100644 index 0000000..ec30ecc --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/djeule2/KadjiBeer.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.djeule2; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class KadjiBeer implements IProduct { + + public final static String NAME = "Kadjibeer"; + public final static BigDecimal PRICE = new BigDecimal(3.0); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/test/java/ch/heigvd/res/chill/domain/djeule2/KadjibeerTest.java b/src/test/java/ch/heigvd/res/chill/domain/djeule2/KadjibeerTest.java new file mode 100644 index 0000000..511a490 --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/djeule2/KadjibeerTest.java @@ -0,0 +1,32 @@ +package ch.heigvd.res.chill.domain.djeule2; + +import ch.heigvd.res.chill.domain.Bartender; +import ch.heigvd.res.chill.domain.wasadigi.Boxer; +import ch.heigvd.res.chill.protocol.OrderRequest; +import ch.heigvd.res.chill.protocol.OrderResponse; +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class KadjibeerTest { + + @Test + void thePriceAndNameForBoxerShouldBeCorrect() { + KadjiBeer beer = new KadjiBeer(); + assertEquals(beer.getName(), KadjiBeer.NAME); + assertEquals(beer.getPrice(), KadjiBeer.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForBoxer() { + Bartender jane = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.djeule2.KadjiBeer"; + OrderRequest request = new OrderRequest(2, productName); + OrderResponse response = jane.order(request); + BigDecimal expectedTotalPrice = KadjiBeer.PRICE.multiply(new BigDecimal(2)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } + +} \ No newline at end of file