From 57bfc5ee56ca54fa787c883f610003f5e8f7e87f Mon Sep 17 00:00:00 2001 From: Aqsa Malik Date: Sun, 17 Sep 2023 22:01:21 -0400 Subject: [PATCH] upgrade junit version and minor improvements to coffee shop kata Signed-off-by: Aqsa Malik --- calendar-kata-solutions/pom.xml | 2 +- calendar-kata/pom.xml | 2 +- code-point-kata-solutions/pom.xml | 2 +- code-point-kata/pom.xml | 2 +- coffee-shop-kata-solutions/pom.xml | 2 +- .../coffeeshopkata/CoffeeShopOrder.java | 7 ++++--- .../coffeeshopkata/beverage/CoffeeDrink.java | 13 ------------- coffee-shop-kata/jdk21/pom.xml | 2 +- .../coffeeshopkata/CoffeeShopOrder.java | 9 +++++---- .../coffeeshopkata/beverage/CoffeeDrink.java | 4 ++-- .../codekatas/coffeeshopkata/food/Bagel.java | 7 ++++++- .../codekatas/coffeeshopkata/food/Cookie.java | 7 ++++++- .../codekatas/coffeeshopkata/food/Donut.java | 7 ++++++- coffee-shop-kata/jdk8/pom.xml | 2 +- .../coffeeshopkata/CoffeeShopOrder.java | 16 ++++++++++++++++ .../codekatas/coffeeshopkata/CoffeeShopTest.java | 1 - deck-of-cards-kata-solutions/pom.xml | 2 +- deck-of-cards-kata/pom.xml | 2 +- donut-kata-solutions/pom.xml | 2 +- donut-kata/pom.xml | 2 +- java-lambda-kata-solutions/pom.xml | 2 +- java-lambda-kata/pom.xml | 2 +- jmh-kata/pom.xml | 2 +- kata-of-katas-solutions/pom.xml | 2 +- kata-of-katas/pom.xml | 2 +- pitest-mutation-kata-solutions/pom.xml | 2 +- pitest-mutation-kata/pom.xml | 2 +- 27 files changed, 63 insertions(+), 44 deletions(-) diff --git a/calendar-kata-solutions/pom.xml b/calendar-kata-solutions/pom.xml index ed16deea..e83f802e 100644 --- a/calendar-kata-solutions/pom.xml +++ b/calendar-kata-solutions/pom.xml @@ -39,7 +39,7 @@ 11.1.0 1.7.2 - 5.9.3 + 5.10.0 diff --git a/calendar-kata/pom.xml b/calendar-kata/pom.xml index 72c1e42b..bcdcae1b 100644 --- a/calendar-kata/pom.xml +++ b/calendar-kata/pom.xml @@ -39,7 +39,7 @@ 11.1.0 1.7.2 - 5.9.3 + 5.10.0 diff --git a/code-point-kata-solutions/pom.xml b/code-point-kata-solutions/pom.xml index 0b1f7586..805820b9 100644 --- a/code-point-kata-solutions/pom.xml +++ b/code-point-kata-solutions/pom.xml @@ -38,7 +38,7 @@ 17 11.1.0 - 5.9.3 + 5.10.0 diff --git a/code-point-kata/pom.xml b/code-point-kata/pom.xml index c9377690..edb5f10e 100644 --- a/code-point-kata/pom.xml +++ b/code-point-kata/pom.xml @@ -38,7 +38,7 @@ 17 11.1.0 - 5.9.3 + 5.10.0 diff --git a/coffee-shop-kata-solutions/pom.xml b/coffee-shop-kata-solutions/pom.xml index ee0fddc5..28dd4062 100644 --- a/coffee-shop-kata-solutions/pom.xml +++ b/coffee-shop-kata-solutions/pom.xml @@ -34,7 +34,7 @@ UTF-8 20 20 - 5.9.3 + 5.10.0 diff --git a/coffee-shop-kata-solutions/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java b/coffee-shop-kata-solutions/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java index 20494b7e..2c89e805 100644 --- a/coffee-shop-kata-solutions/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java +++ b/coffee-shop-kata-solutions/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java @@ -109,14 +109,15 @@ else if (item instanceof Cookie(CookieType cookieType, boolean warmed)) } /** - * Create and print drink order + * Return a list of custom strings for the customer's drinks! * First drink : Hot Americano * Second drink : Hot Caramel Latte with Almond Milk * Third drink : Hot Vanilla Macchiato with Whole Milk * Fourth drink : MATCHA Tea *

- * NOTE: Use interface to create four drinks - * Use the toString() to obtain descriptions of the dinks + * NOTE: This method utilizes sealed classes and permit to define coffee drink types + * (e.g., Americano, Latte, Macchiato) are allowed within a hierarchy. + * However, Tea is not part of this hierarchy. */ public List getDrinkForOrder() { diff --git a/coffee-shop-kata-solutions/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/CoffeeDrink.java b/coffee-shop-kata-solutions/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/CoffeeDrink.java index 8d9d886a..2fd3fdb8 100644 --- a/coffee-shop-kata-solutions/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/CoffeeDrink.java +++ b/coffee-shop-kata-solutions/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/CoffeeDrink.java @@ -16,19 +16,6 @@ package bnymellon.codekatas.coffeeshopkata.beverage; -/** - * Prior to Java 15, a class was either declared as 'final' or left 'open,' - * which meant that the class could be extended infinitely. - * With the introduction of "sealed" classes, it becomes possible to - * establish a controlled hierarchy for extensions. - * Modify the following class to permit only the classes - * Latte, Macchiato, and Americano, while excluding Tea. - * - *

- * NOTE: This class hierarchy shows the usage of sealed classes - */ - -//TODO Convert to Sealed interface public sealed interface CoffeeDrink extends Beverage permits Latte, Macchiato, Americano { int espressoShot(); diff --git a/coffee-shop-kata/jdk21/pom.xml b/coffee-shop-kata/jdk21/pom.xml index 2b5c1a04..e99dbc34 100644 --- a/coffee-shop-kata/jdk21/pom.xml +++ b/coffee-shop-kata/jdk21/pom.xml @@ -32,7 +32,7 @@ UTF-8 20 20 - 5.9.3 + 5.10.0 diff --git a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java index 329edc25..13b2e6d9 100644 --- a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java +++ b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java @@ -21,7 +21,6 @@ public class CoffeeShopOrder { - private final String customerName; private final List orderItems; @@ -67,17 +66,19 @@ public String generateReceipt() { } /** - * Create and print drink order + * Return a list of custom strings for the customer's drinks! * First drink : Hot Americano * Second drink : Hot Caramel Latte with Almond Milk * Third drink : Hot Vanilla Macchiato with Whole Milk * Fourth drink : MATCHA Tea *

- * NOTE: Use interface to create four drinks + * NOTE: This method utilize sealed classes and permit to define coffee drink types + * (e.g., Americano, Latte, Macchiato) are allowed within a hierarchy. + * However, Tea is not part of this hierarchy. */ public List getDrinkForOrder() { - // TODO implement method + // TODO implement method logic here return null; } } diff --git a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/CoffeeDrink.java b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/CoffeeDrink.java index b452d122..5754681a 100644 --- a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/CoffeeDrink.java +++ b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/CoffeeDrink.java @@ -24,11 +24,11 @@ * Modify the following class to permit only the classes * Latte, Macchiato, and Americano, while excluding Tea. * - *

* NOTE: This class hierarchy shows the usage of sealed classes + * @see ... */ -//TODO Convert to Sealed interface +// TODO: Convert to Sealed interface public interface CoffeeDrink extends Beverage { int espressoShot(); diff --git a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Bagel.java b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Bagel.java index c7165651..4357502e 100644 --- a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Bagel.java +++ b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Bagel.java @@ -19,10 +19,15 @@ import java.util.Objects; /** - * TODO: convert class to record + * Replace the entire class with a Record. + * This replaces the need for a constructor, getters, toString(), + * equals() and hashcode() method + * NOTE: This example highlights the usage of a record to replace the + * boilerplate of a plain Java class. * * @see ... */ +// TODO: convert class to record public class Bagel implements BakeryItem { private final BagelType bagelType; diff --git a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Cookie.java b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Cookie.java index 2106df04..a4685d43 100644 --- a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Cookie.java +++ b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Cookie.java @@ -19,10 +19,15 @@ import java.util.Objects; /** - * TODO: convert class to record + * Replace the entire class with a Record. + * This replaces the need for a constructor, getters, toString(), + * equals() and hashcode() method + * NOTE: This example highlights the usage of a record to replace the + * boilerplate of a plain Java class. * * @see ... */ +// TODO: convert class to record public class Cookie implements BakeryItem { private final CookieType cookieType; diff --git a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Donut.java b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Donut.java index abf8b930..1ba1460e 100644 --- a/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Donut.java +++ b/coffee-shop-kata/jdk21/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Donut.java @@ -19,10 +19,15 @@ import java.util.Objects; /** - * TODO: convert class to record + * Replace the entire class with a Record. + * This replaces the need for a constructor, getters, toString(), + * equals() and hashcode() method + * NOTE: This example highlights the usage of a record to replace the + * boilerplate of a plain Java class. * * @see ... */ +// TODO: convert class to record public class Donut implements BakeryItem { private final DonutType donutType; diff --git a/coffee-shop-kata/jdk8/pom.xml b/coffee-shop-kata/jdk8/pom.xml index e47fb918..67671795 100644 --- a/coffee-shop-kata/jdk8/pom.xml +++ b/coffee-shop-kata/jdk8/pom.xml @@ -32,7 +32,7 @@ 8 8 UTF-8 - 5.9.3 + 5.10.0 diff --git a/coffee-shop-kata/jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java b/coffee-shop-kata/jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java index 8d9c6d95..34fb636f 100644 --- a/coffee-shop-kata/jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java +++ b/coffee-shop-kata/jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java @@ -1,3 +1,19 @@ +/* + * Copyright 2023 The Bank of New York Mellon. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package bnymellon.codekatas.coffeeshopkata; import bnymellon.codekatas.coffeeshopkata.beverage.Americano; diff --git a/coffee-shop-kata/jdk8/src/test/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopTest.java b/coffee-shop-kata/jdk8/src/test/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopTest.java index 56b1a92d..434643aa 100644 --- a/coffee-shop-kata/jdk8/src/test/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopTest.java +++ b/coffee-shop-kata/jdk8/src/test/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopTest.java @@ -118,7 +118,6 @@ public void testDonutGetters() assertEquals(donut1.getDonutType(), GLAZED); } - @Test public void getDrinkItems() { diff --git a/deck-of-cards-kata-solutions/pom.xml b/deck-of-cards-kata-solutions/pom.xml index 20084c2e..7266586d 100644 --- a/deck-of-cards-kata-solutions/pom.xml +++ b/deck-of-cards-kata-solutions/pom.xml @@ -41,7 +41,7 @@ 11.1.0 32.1.1-jre 0.10.4 - 5.9.3 + 5.10.0 10.1 3.1.2 diff --git a/deck-of-cards-kata/pom.xml b/deck-of-cards-kata/pom.xml index 09b1d1c8..e944273b 100644 --- a/deck-of-cards-kata/pom.xml +++ b/deck-of-cards-kata/pom.xml @@ -41,7 +41,7 @@ 11.1.0 32.1.1-jre 0.10.4 - 5.9.3 + 5.10.0 diff --git a/donut-kata-solutions/pom.xml b/donut-kata-solutions/pom.xml index 63e1dc11..e4c5f0d5 100644 --- a/donut-kata-solutions/pom.xml +++ b/donut-kata-solutions/pom.xml @@ -39,7 +39,7 @@ 1.9.0 11.1.0 - 5.9.3 + 5.10.0 diff --git a/donut-kata/pom.xml b/donut-kata/pom.xml index b29cb52f..2e495313 100644 --- a/donut-kata/pom.xml +++ b/donut-kata/pom.xml @@ -40,7 +40,7 @@ 1.9.0 11.1.0 - 5.9.3 + 5.10.0 diff --git a/java-lambda-kata-solutions/pom.xml b/java-lambda-kata-solutions/pom.xml index 2f16dc0b..c81663a6 100644 --- a/java-lambda-kata-solutions/pom.xml +++ b/java-lambda-kata-solutions/pom.xml @@ -37,7 +37,7 @@ 17 11.1.0 - 5.9.3 + 5.10.0 diff --git a/java-lambda-kata/pom.xml b/java-lambda-kata/pom.xml index 4d68a437..f527b247 100644 --- a/java-lambda-kata/pom.xml +++ b/java-lambda-kata/pom.xml @@ -38,7 +38,7 @@ 17 11.1.0 - 5.9.3 + 5.10.0 diff --git a/jmh-kata/pom.xml b/jmh-kata/pom.xml index adcae843..52af9351 100644 --- a/jmh-kata/pom.xml +++ b/jmh-kata/pom.xml @@ -40,7 +40,7 @@ 11.1.0 1.36 - 5.9.3 + 5.10.0 diff --git a/kata-of-katas-solutions/pom.xml b/kata-of-katas-solutions/pom.xml index fa426d3a..3c6c502c 100644 --- a/kata-of-katas-solutions/pom.xml +++ b/kata-of-katas-solutions/pom.xml @@ -37,7 +37,7 @@ 17 11.1.0 - 5.9.3 + 5.10.0 diff --git a/kata-of-katas/pom.xml b/kata-of-katas/pom.xml index 004456f2..a4a5d4ac 100644 --- a/kata-of-katas/pom.xml +++ b/kata-of-katas/pom.xml @@ -37,7 +37,7 @@ 17 11.1.0 - 5.9.3 + 5.10.0 diff --git a/pitest-mutation-kata-solutions/pom.xml b/pitest-mutation-kata-solutions/pom.xml index 70946736..87cbc3cc 100644 --- a/pitest-mutation-kata-solutions/pom.xml +++ b/pitest-mutation-kata-solutions/pom.xml @@ -34,7 +34,7 @@ 17 11.1.0 - 5.9.3 + 5.10.0 2.22.2 1.14.2 diff --git a/pitest-mutation-kata/pom.xml b/pitest-mutation-kata/pom.xml index a09bc730..f1773b43 100644 --- a/pitest-mutation-kata/pom.xml +++ b/pitest-mutation-kata/pom.xml @@ -34,7 +34,7 @@ 17 11.1.0 - 5.9.3 + 5.10.0 2.22.2 1.14.2