From 0048ed80a79819cee0a2963ed169f33de48c2d27 Mon Sep 17 00:00:00 2001 From: KDVL Date: Wed, 17 Apr 2019 18:47:31 +0200 Subject: [PATCH] Boisee added --- .../res/pizza/domain/kevindovale/Boisee.java | 20 ++++++++++++ .../pizza/domain/kevindovale/BoiseeTest.java | 31 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/main/java/ch/heigvd/res/pizza/domain/kevindovale/Boisee.java create mode 100644 src/test/java/ch/heigvd/res/pizza/domain/kevindovale/BoiseeTest.java diff --git a/src/main/java/ch/heigvd/res/pizza/domain/kevindovale/Boisee.java b/src/main/java/ch/heigvd/res/pizza/domain/kevindovale/Boisee.java new file mode 100644 index 0000000..66158aa --- /dev/null +++ b/src/main/java/ch/heigvd/res/pizza/domain/kevindovale/Boisee.java @@ -0,0 +1,20 @@ +package ch.heigvd.res.pizza.domain.kevindovale; + +import ch.heigvd.res.pizza.domain.IProduct; + +import java.math.BigDecimal; + +public class Boisee implements IProduct { + + public final static String NAME = "Boisee Pizza"; + public final static BigDecimal PRICE = new BigDecimal(20); + + public String getName() { + return NAME; + } + + public BigDecimal getPrice(){ + return PRICE; + } +} + diff --git a/src/test/java/ch/heigvd/res/pizza/domain/kevindovale/BoiseeTest.java b/src/test/java/ch/heigvd/res/pizza/domain/kevindovale/BoiseeTest.java new file mode 100644 index 0000000..eb00275 --- /dev/null +++ b/src/test/java/ch/heigvd/res/pizza/domain/kevindovale/BoiseeTest.java @@ -0,0 +1,31 @@ +package ch.heigvd.res.pizza.domain.kevindovale; + +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.*; + +class BoiseeTest { + + @Test + void thePriceAndNameForBoiseeShouldBeCorrect() { + Boisee pizza = new Boisee(); + assertEquals(pizza.getName(), Boisee.NAME); + assertEquals(pizza.getPrice(), Boisee.PRICE); + } + + @Test + void aPizzaioloShouldAcceptAnOrderForBoisee() { + Pizzaiolo mario = new Pizzaiolo(); + String productName = "ch.heigvd.res.pizza.domain.kevindovale.Boisee"; + int numberOfPizzas = 2; + OrderRequest request = new OrderRequest(numberOfPizzas, productName); + OrderResponse response = mario.order(request); + BigDecimal expectedTotalPrice = Boisee.PRICE.multiply(new BigDecimal(numberOfPizzas)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } +} \ No newline at end of file