From 49f738655224e27ccdcc9eaf1ab8c0f6f9d6112b Mon Sep 17 00:00:00 2001 From: Thierry OTTO <thierry.otto@heig-vd.ch> Date: Sun, 3 Mar 2019 15:21:33 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Ajout=20de=20la=20bi=C3=A8re=20CaptaineMous?= =?UTF-8?q?se=20avec=20les=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/thierryotto/CaptaineMousse.java | 21 +++++++++++++ .../thierryotto/CaptaineMousseTest.java | 30 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/main/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousse.java create mode 100644 src/test/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousseTest.java 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/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..6d96ca9 --- /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 getName() { + CaptaineMousse beer = new CaptaineMousse(); + assertEquals(beer.getName(), CaptaineMousse.NAME); + assertEquals(beer.getPrice(), CaptaineMousse.PRICE); + } + + @Test + void getPrice() { + 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 From b63c28d32518675f94a1b487f07f3ecf60289b8b Mon Sep 17 00:00:00 2001 From: Thierry OTTO <thierry.otto@heig-vd.ch> Date: Sun, 3 Mar 2019 15:46:58 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Ajout=20de=20la=20bi=C3=A8re=20Docteur=20Ga?= =?UTF-8?q?bs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chill/domain/thierryotto/DocteurGabs.java | 21 +++++++++++++ .../thierryotto/CaptaineMousseTest.java | 4 +-- .../domain/thierryotto/DocteurGabsTest.java | 30 +++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 src/main/java/ch/heigvd/res/chill/domain/thierryotto/DocteurGabs.java create mode 100644 src/test/java/ch/heigvd/res/chill/domain/thierryotto/DocteurGabsTest.java 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/test/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousseTest.java b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousseTest.java index 6d96ca9..98b325d 100644 --- a/src/test/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousseTest.java +++ b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/CaptaineMousseTest.java @@ -12,14 +12,14 @@ class CaptaineMousseTest { @Test - void getName() { + void thePriceAndNameForCaptaineMousseShouldBeCorrect() { CaptaineMousse beer = new CaptaineMousse(); assertEquals(beer.getName(), CaptaineMousse.NAME); assertEquals(beer.getPrice(), CaptaineMousse.PRICE); } @Test - void getPrice() { + void aBartenderShouldAcceptAnOrderForCaptaineMousse() { Bartender bob = new Bartender(); String productName = "ch.heigvd.res.chill.domain.thierryotto.CaptaineMousse"; OrderRequest request = new OrderRequest(3, productName); 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 From 1bd6454533658268b03fb363312170cd7f7cfad4 Mon Sep 17 00:00:00 2001 From: Thierry OTTO <thierry.otto@heig-vd.ch> Date: Sun, 10 Mar 2019 21:48:15 +0100 Subject: [PATCH 3/4] Add Beer Heineken with tests --- .../chill/domain/thierryotto/Heineken.java | 21 +++++++++++++ .../domain/thierryotto/HeinekenTest.java | 30 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/main/java/ch/heigvd/res/chill/domain/thierryotto/Heineken.java create mode 100644 src/test/java/ch/heigvd/res/chill/domain/thierryotto/HeinekenTest.java 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/HeinekenTest.java b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/HeinekenTest.java new file mode 100644 index 0000000..92b66b6 --- /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 = DocteurGabs.PRICE.multiply(new BigDecimal(3)); + assertEquals(expectedTotalPrice, response.getTotalPrice()); + } +} \ No newline at end of file From 6c1fa10985643133c04ab53fdcc5b6ee6d54625c Mon Sep 17 00:00:00 2001 From: Thierry OTTO <thierry.otto@heig-vd.ch> Date: Sun, 10 Mar 2019 21:56:08 +0100 Subject: [PATCH 4/4] Add beer Cardinal with tests --- .../chill/domain/thierryotto/Cardinal.java | 21 +++++++++++++ .../domain/thierryotto/CardinalTest.java | 30 +++++++++++++++++++ .../domain/thierryotto/HeinekenTest.java | 2 +- 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/main/java/ch/heigvd/res/chill/domain/thierryotto/Cardinal.java create mode 100644 src/test/java/ch/heigvd/res/chill/domain/thierryotto/CardinalTest.java 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/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/HeinekenTest.java b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/HeinekenTest.java index 92b66b6..6789241 100644 --- a/src/test/java/ch/heigvd/res/chill/domain/thierryotto/HeinekenTest.java +++ b/src/test/java/ch/heigvd/res/chill/domain/thierryotto/HeinekenTest.java @@ -24,7 +24,7 @@ void aBartenderShouldAcceptAnOrderForHeineken() { String productName = "ch.heigvd.res.chill.domain.thierryotto.Heineken"; OrderRequest request = new OrderRequest(3, productName); OrderResponse response = bob.order(request); - BigDecimal expectedTotalPrice = DocteurGabs.PRICE.multiply(new BigDecimal(3)); + BigDecimal expectedTotalPrice = Heineken.PRICE.multiply(new BigDecimal(3)); assertEquals(expectedTotalPrice, response.getTotalPrice()); } } \ No newline at end of file