diff --git a/pom.xml b/pom.xml index 5078dcae..50924750 100644 --- a/pom.xml +++ b/pom.xml @@ -1,49 +1,28 @@ + + 4.0.0 - - 4.0.0 + org.example + Teaching-HEIGVD-RES-2021-Chill + 1.0-SNAPSHOT + + + org.projectlombok + lombok + 1.18.12 + + + org.junit.jupiter + junit-jupiter-engine + 5.4.0 + test + + - ch.heigvd.res - chill - 1.0-SNAPSHOT - - chill - - - UTF-8 - 1.8 - 1.8 - - - - - org.projectlombok - lombok - 1.18.2 - provided - - - org.junit.jupiter - junit-jupiter-api - 5.4.0 - test - - - org.junit.jupiter - junit-jupiter-engine - 5.4.0 - test - - - - - - - maven-surefire-plugin - 2.22.1 - - - - - + + 1.7 + 1.7 + + \ No newline at end of file diff --git a/src/main/java/ch/heigvd/res/chill/domain/OvichHeigVd/RedBull.java b/src/main/java/ch/heigvd/res/chill/domain/OvichHeigVd/RedBull.java new file mode 100644 index 00000000..296d9141 --- /dev/null +++ b/src/main/java/ch/heigvd/res/chill/domain/OvichHeigVd/RedBull.java @@ -0,0 +1,21 @@ +package ch.heigvd.res.chill.domain.wasadigi; + +import ch.heigvd.res.chill.domain.IProduct; + +import java.math.BigDecimal; + +public class RedBull implements IProduct { + + public final static String NAME = "RedBull"; + 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/main.iml b/src/main/main.iml new file mode 100644 index 00000000..908ad4f5 --- /dev/null +++ b/src/main/main.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/java/ch/heigvd/res/chill/domain/OvichHeigVd/RedBullTest.java b/src/test/java/ch/heigvd/res/chill/domain/OvichHeigVd/RedBullTest.java new file mode 100644 index 00000000..139425fd --- /dev/null +++ b/src/test/java/ch/heigvd/res/chill/domain/OvichHeigVd/RedBullTest.java @@ -0,0 +1,31 @@ +package ch.heigvd.res.chill.domain.OvichHeigVd; + +import static org.junit.jupiter.api.Assertions.*; + +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 RedBullTest { + @Test + void thePriceAndNameForRedbullShouldBeCorrect(){ + RedBull drink = new RedBull(); + assertEquals(drink.getName(), RedBull.NAME); + assertEquals(drink.getPrice(), RedBull.PRICE); + } + + @Test + void aBartenderShouldAcceptAnOrderForRedbull() { + Bartender jane = new Bartender(); + String productName = "ch.heigvd.res.chill.domain.wasadigi.RedBull"; + OrderRequest request = new OrderRequest(3, productName); + OrderResponse response = jane.order(request); + BigDecimal expectedTotalPrice = RedBull.PRICE.multiply(new BigDecimal(3)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } +} \ No newline at end of file diff --git a/src/test/test.iml b/src/test/test.iml new file mode 100644 index 00000000..d041215c --- /dev/null +++ b/src/test/test.iml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file