diff --git a/src/main/java/ch/heigvd/res/chill/domain/thomasrieder/Chopfab.java b/src/main/java/ch/heigvd/res/chill/domain/thomasrieder/Chopfab.java new file mode 100644 index 0000000..50cba3c --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/thomasrieder/Chopfab.java @@ -0,0 +1,23 @@ +package ch.heigvd.res.chill.domain.thomasrieder; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class Chopfab implements IProduct{ + + public final static String NAME = "Chopfab"; + public final static BigDecimal PRICE = new BigDecimal(2.0); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} + + diff --git a/src/main/java/ch/heigvd/res/chill/domain/thomasrieder/InnisAndGunn.java b/src/main/java/ch/heigvd/res/chill/domain/thomasrieder/InnisAndGunn.java new file mode 100644 index 0000000..b78eda6 --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/thomasrieder/InnisAndGunn.java @@ -0,0 +1,23 @@ +package ch.heigvd.res.chill.domain.thomasrieder; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class InnisAndGunn implements IProduct{ + + public final static String NAME = "Innis & Gunn"; + 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/thomasrieder/ChopfabTest.java b/src/test/java/ch/heigvd/res/chill/domain/thomasrieder/ChopfabTest.java new file mode 100644 index 0000000..39149ae --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/thomasrieder/ChopfabTest.java @@ -0,0 +1,31 @@ +package ch.heigvd.res.chill.domain.thomasrieder; + +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 ChopfabTest { + + @Test + void thePriceAndNameForBoxerShouldBeCorrect() { + Chopfab beer = new Chopfab(); + assertEquals(beer.getName(), Chopfab.NAME); + assertEquals(beer.getPrice(), Chopfab.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForBoxer() { + Bartender jane = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.thomasrieder.Chopfab"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = jane.order(request); + BigDecimal expectedTotalPrice = Chopfab.PRICE.multiply(new BigDecimal(3)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } + +} \ No newline at end of file diff --git a/src/test/java/ch/heigvd/res/chill/domain/thomasrieder/InnisAndGunnTest.java b/src/test/java/ch/heigvd/res/chill/domain/thomasrieder/InnisAndGunnTest.java new file mode 100644 index 0000000..34ebc16 --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/thomasrieder/InnisAndGunnTest.java @@ -0,0 +1,31 @@ +package ch.heigvd.res.chill.domain.thomasrieder; + +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 InnisAndGunnTest { + + @Test + void thePriceAndNameForBoxerShouldBeCorrect() { + InnisAndGunn beer = new InnisAndGunn(); + assertEquals(beer.getName(), InnisAndGunn.NAME); + assertEquals(beer.getPrice(), InnisAndGunn.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForBoxer() { + Bartender jane = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.thomasrieder.InnisAndGunn"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = jane.order(request); + BigDecimal expectedTotalPrice = InnisAndGunn.PRICE.multiply(new BigDecimal(3)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } + +} \ No newline at end of file