diff --git a/src/main/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousse.java b/src/main/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousse.java new file mode 100644 index 0000000..844a8ad --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousse.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.thierryotto; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class CaptaineMousse implements IProduct { + + public final static String NAME = "Cap'Taine Mousse"; + public final static BigDecimal PRICE = new BigDecimal(3.5); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/main/java/ch/heigvd/res/chill/domain/thierryotto/Cardinal.java b/src/main/java/ch/heigvd/res/chill/domain/thierryotto/Cardinal.java new file mode 100644 index 0000000..204fa15 --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/thierryotto/Cardinal.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.thierryotto; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class Cardinal implements IProduct { + + public final static String NAME = "Cardinal"; + public final static BigDecimal PRICE = new BigDecimal(2.5); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/main/java/ch/heigvd/res/chill/domain/thierryotto/DocteurGabs.java b/src/main/java/ch/heigvd/res/chill/domain/thierryotto/DocteurGabs.java new file mode 100644 index 0000000..38b1e49 --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/thierryotto/DocteurGabs.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.thierryotto; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class DocteurGabs implements IProduct { + + public final static String NAME = "Docteur Gabs"; + public final static BigDecimal PRICE = new BigDecimal(2.8); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/main/java/ch/heigvd/res/chill/domain/thierryotto/Heineken.java b/src/main/java/ch/heigvd/res/chill/domain/thierryotto/Heineken.java new file mode 100644 index 0000000..efc984a --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/thierryotto/Heineken.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.thierryotto; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class Heineken implements IProduct { + + public final static String NAME = "Heineken"; + public final static BigDecimal PRICE = new BigDecimal(4.1); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/test/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousseTest.java b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousseTest.java new file mode 100644 index 0000000..98b325d --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousseTest.java @@ -0,0 +1,30 @@ +package ch.heigvd.res.chill.domain.thierryotto; + +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.*; + +class CaptaineMousseTest { + + @Test + void thePriceAndNameForCaptaineMousseShouldBeCorrect() { + CaptaineMousse beer = new CaptaineMousse(); + assertEquals(beer.getName(), CaptaineMousse.NAME); + assertEquals(beer.getPrice(), CaptaineMousse.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForCaptaineMousse() { + Bartender bob = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.thierryotto.CaptaineMousse"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = bob.order(request); + BigDecimal expectedTotalPrice = CaptaineMousse.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/thierryotto/CardinalTest.java b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/CardinalTest.java new file mode 100644 index 0000000..55d1990 --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/CardinalTest.java @@ -0,0 +1,30 @@ +package ch.heigvd.res.chill.domain.thierryotto; + +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 CardinalTest { + + @Test + void thePriceAndNameForCardinalShouldBeCorrect() { + Cardinal beer = new Cardinal(); + assertEquals(beer.getName(), Cardinal.NAME); + assertEquals(beer.getPrice(), Cardinal.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForCardinal() { + Bartender bob = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.thierryotto.Cardinal"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = bob.order(request); + BigDecimal expectedTotalPrice = Cardinal.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/thierryotto/DocteurGabsTest.java b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/DocteurGabsTest.java new file mode 100644 index 0000000..d2cee28 --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/DocteurGabsTest.java @@ -0,0 +1,30 @@ +package ch.heigvd.res.chill.domain.thierryotto; + +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 DocteurGabsTest { + + @Test + void thePriceAndNameForDocteurGabsShouldBeCorrect() { + DocteurGabs beer = new DocteurGabs(); + assertEquals(beer.getName(), DocteurGabs.NAME); + assertEquals(beer.getPrice(), DocteurGabs.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForDocteurGabs() { + Bartender bob = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.thierryotto.DocteurGabs"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = bob.order(request); + BigDecimal expectedTotalPrice = DocteurGabs.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/thierryotto/HeinekenTest.java b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/HeinekenTest.java new file mode 100644 index 0000000..6789241 --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/HeinekenTest.java @@ -0,0 +1,30 @@ +package ch.heigvd.res.chill.domain.thierryotto; + +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 HeinekenTest { + + @Test + void thePriceAndNameForHeinekenShouldBeCorrect() { + Heineken beer = new Heineken(); + assertEquals(beer.getName(), Heineken.NAME); + assertEquals(beer.getPrice(), Heineken.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForHeineken() { + Bartender bob = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.thierryotto.Heineken"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = bob.order(request); + BigDecimal expectedTotalPrice = Heineken.PRICE.multiply(new BigDecimal(3)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } +} \ No newline at end of file