diff --git a/src/main/java/ch/heigvd/res/pizza/domain/lohaheigvd/Parmesan.java b/src/main/java/ch/heigvd/res/pizza/domain/lohaheigvd/Parmesan.java new file mode 100644 index 0000000..ec244b7 --- /dev/null +++ b/src/main/java/ch/heigvd/res/pizza/domain/lohaheigvd/Parmesan.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.pizza.domain.wasadigi; + +import ch.heigvd.res.pizza.domain.IProduct; + +import java.math.BigDecimal; + +public class Parmesan implements IProduct { + + public final static String NAME = "Parmesan"; + public final static BigDecimal PRICE = new BigDecimal(16.0); + + @Override + public String getName() { + return NAME; + } + + @Override + public BigDecimal getPrice() { + return PRICE; + } +} diff --git a/src/test/java/ch/heigvd/res/pizza/domain/lohaheigvd/ParmesanTest.java b/src/test/java/ch/heigvd/res/pizza/domain/lohaheigvd/ParmesanTest.java new file mode 100644 index 0000000..43d84d0 --- /dev/null +++ b/src/test/java/ch/heigvd/res/pizza/domain/lohaheigvd/ParmesanTest.java @@ -0,0 +1,32 @@ +package ch.heigvd.res.pizza.domain.wasadigi; + +import ch.heigvd.res.pizza.domain.Pizzaiolo; +import ch.heigvd.res.pizza.protocol.OrderRequest; +import ch.heigvd.res.pizza.protocol.OrderResponse; +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class ParmesanTest { + + @Test + void thePriceAndNameForParmesanShouldBeCorrect() { + Parmesan beer = new Parmesan(); + assertEquals(beer.getName(), Parmesan.NAME); + assertEquals(beer.getPrice(), Parmesan.PRICE); + } + + @Test + void aPizzaioloShouldAcceptAnOrderForParmesan() { + Pizzaiolo mario = new Pizzaiolo(); + String productName = "ch.heigvd.res.pizza.domain.wasadigi.Parmesan"; + int numberOfPizzas = 2; + OrderRequest request = new OrderRequest(numberOfPizzas, productName); + OrderResponse response = mario.order(request); + BigDecimal expectedTotalPrice = Parmesan.PRICE.multiply(new BigDecimal(numberOfPizzas)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } + +} \ No newline at end of file