diff --git a/src/main/java/ch/heigvd/res/chill/domain/mercierjo/Adelscott.java b/src/main/java/ch/heigvd/res/chill/domain/mercierjo/Adelscott.java new file mode 100644 index 000000000..2efed696e --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/mercierjo/Adelscott.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.mercierjo; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class Adelscott implements IProduct { + + public final static String NAME = "Adelscott"; + public final static BigDecimal PRICE = new BigDecimal(5.8); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/main/java/ch/heigvd/res/chill/domain/mercierjo/Kilkenny.java b/src/main/java/ch/heigvd/res/chill/domain/mercierjo/Kilkenny.java new file mode 100644 index 000000000..5fdc6c321 --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/mercierjo/Kilkenny.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.mercierjo; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class Kilkenny implements IProduct { + + public final static String NAME = "Kilkenny"; + public final static BigDecimal PRICE = new BigDecimal(4.9); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/main/java/ch/heigvd/res/chill/domain/mercierjo/Somersby.java b/src/main/java/ch/heigvd/res/chill/domain/mercierjo/Somersby.java new file mode 100644 index 000000000..a55b5544d --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/mercierjo/Somersby.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.mercierjo; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class Somersby implements IProduct { + + public final static String NAME = "Somersby"; + public final static BigDecimal PRICE = new BigDecimal(5.8); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/test/java/ch/heigvd/res/chill/domain/mercierjo/AdelscottTest.java b/src/test/java/ch/heigvd/res/chill/domain/mercierjo/AdelscottTest.java new file mode 100644 index 000000000..5bd5eba12 --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/mercierjo/AdelscottTest.java @@ -0,0 +1,30 @@ +package ch.heigvd.res.chill.domain.mercierjo; + +import ch.heigvd.res.chill.domain.Bartender; +import ch.heigvd.res.chill.domain.mercierjo.Adelscott; +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 AdelscottTest { + @Test + void thePriceAndNameForAdelscottShouldBeCorrect() { + Adelscott beer = new Adelscott(); + assertEquals(beer.getName(), Adelscott.NAME); + assertEquals(beer.getPrice(), Adelscott.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForAdelscott() { + Bartender jane = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.mercierjo.Adelscott"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = jane.order(request); + BigDecimal expectedTotalPrice = Adelscott.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/mercierjo/KilkennyTest.java b/src/test/java/ch/heigvd/res/chill/domain/mercierjo/KilkennyTest.java new file mode 100644 index 000000000..11f0f2c51 --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/mercierjo/KilkennyTest.java @@ -0,0 +1,29 @@ +package ch.heigvd.res.chill.domain.mercierjo; + +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 KilkennyTest { + @Test + void thePriceAndNameForKilkennyShouldBeCorrect() { + Kilkenny beer = new Kilkenny(); + assertEquals(beer.getName(), Kilkenny.NAME); + assertEquals(beer.getPrice(), Kilkenny.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForKilkenny() { + Bartender jane = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.mercierjo.Kilkenny"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = jane.order(request); + BigDecimal expectedTotalPrice = Kilkenny.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/mercierjo/SomersbyTest.java b/src/test/java/ch/heigvd/res/chill/domain/mercierjo/SomersbyTest.java new file mode 100644 index 000000000..646b919ad --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/mercierjo/SomersbyTest.java @@ -0,0 +1,29 @@ +package ch.heigvd.res.chill.domain.mercierjo; + +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 SomersbyTest { + @Test + void thePriceAndNameForSomersbyShouldBeCorrect() { + Somersby beer = new Somersby(); + assertEquals(beer.getName(), Somersby.NAME); + assertEquals(beer.getPrice(), Somersby.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForSomersby() { + Bartender jane = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.mercierjo.Somersby"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = jane.order(request); + BigDecimal expectedTotalPrice = Somersby.PRICE.multiply(new BigDecimal(3)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } +} \ No newline at end of file