diff --git a/src/main/java/ch/heigvd/res/chill/domain/Diluckshan/Singha.java b/src/main/java/ch/heigvd/res/chill/domain/Diluckshan/Singha.java new file mode 100644 index 0000000..3d59525 --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/Diluckshan/Singha.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.Diluckshan; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class Singha implements IProduct { + + public final static String NAME = "singha"; + public final static BigDecimal PRICE = new BigDecimal(6.2); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/test/java/ch/heigvd/res/chill/domain/Diluckshan/SinghaTest.java b/src/test/java/ch/heigvd/res/chill/domain/Diluckshan/SinghaTest.java new file mode 100644 index 0000000..f0b9eee --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/Diluckshan/SinghaTest.java @@ -0,0 +1,32 @@ +package ch.heigvd.res.chill.domain.Diluckshan; + +import ch.heigvd.res.chill.domain.Bartender; +import ch.heigvd.res.chill.domain.Diluckshan.Singha; +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 SinghaTest { + + @Test + void thePriceAndNameForSinghaShouldBeCorrect() { + Singha beer = new Singha(); + assertEquals(beer.getName(), Singha.NAME); + assertEquals(beer.getPrice(), Singha.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForSingha() { + Bartender jane = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.Diluckshan.Singha"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = jane.order(request); + BigDecimal expectedTotalPrice = Singha.PRICE.multiply(new BigDecimal(3)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } + +} \ No newline at end of file