diff --git a/src/main/java/ch/heigvd/res/chill/domain/nilsbasset/Gabs.java b/src/main/java/ch/heigvd/res/chill/domain/nilsbasset/Gabs.java new file mode 100644 index 00000000..e2f2bec9 --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/nilsbasset/Gabs.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.nilsbasset; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class Gabs implements IProduct { + + public final static String NAME = "Gabs"; + 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/nilsbasset/GabsTest.java b/src/test/java/ch/heigvd/res/chill/domain/nilsbasset/GabsTest.java new file mode 100644 index 00000000..f2031ed4 --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/nilsbasset/GabsTest.java @@ -0,0 +1,31 @@ +package ch.heigvd.res.chill.domain.nilsbasset; + +import ch.heigvd.res.chill.domain.Bartender; +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 GabsTest { + + @Test + void thePriceAndNameForGabsShouldBeCorrect() { + Gabs beer = new Gabs(); + assertEquals(beer.getName(), Gabs.NAME); + assertEquals(beer.getPrice(), Gabs.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForGabs() { + Bartender jane = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.nilsbasset.Gabs"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = jane.order(request); + BigDecimal expectedTotalPrice = Gabs.PRICE.multiply(new BigDecimal(3)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } + +} \ No newline at end of file