Skip to content

Commit

Permalink
Merge pull request #143 from emilie-robichaud/master
Browse files Browse the repository at this point in the history
Fix broken links, comment cleanup
  • Loading branch information
donraab authored Sep 18, 2023
2 parents 7ad86a9 + db25e0d commit 6ff1649
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ public CoffeeShopOrder(String customerName, List<Item> orderItems)

/**
* Return a list of custom strings for the customer's food items!
* If the item is a Bagel: Print [bagelType] with [spreadType]
* If the item is a Cookie: Print [cookieType]
* If the item is a Donut: Print [donutType]
* The string format for each food item is as follows:
* If the item is a Bagel: "[bagelType] with [spreadType]"
* If the item is a Cookie: "[cookieType]"
* If the item is a Donut: "[donutType]"
* Otherwise: throw new IllegalStateException()
* <p>
* NOTE: This method show-cases a switch-case pattern matching.
*/
Expand Down Expand Up @@ -80,7 +82,6 @@ public List<String> getFoodItemsForOrder()
* Total: $Total Price
* <p>
* NOTE: The method highlights the usage of a record deconstruction pattern
* HINT: Use instanceOf
*/
public String generateReceipt()
{
Expand Down Expand Up @@ -110,12 +111,12 @@ else if (item instanceof Cookie(CookieType cookieType, boolean warmed))

/**
* 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
* First drink: Hot Americano
* Second drink: Hot Caramel Latte with Almond Milk
* Third drink: Hot Vanilla Macchiato with Whole Milk
* Fourth drink: Matcha Tea
* <p>
* NOTE: This method utilizes sealed classes and permit to define coffee drink types
* 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.
*/
Expand Down
Binary file modified coffee-shop-kata/CoffeeShopDomain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions coffee-shop-kata/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
2. Launch the project in the IDE as a maven project. You can find instructions on how to do
that [here](https://www.jetbrains.com/idea/guide/tutorials/working-with-maven/importing-a-project/).
3. To verify that the Java 8 module is set up correctly,
run [CoffeeShopTest](/jdk8/src/test/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopTest.java) in the
old-java-features module - the class should compile and all tests will pass.
run [CoffeeShopTest](jdk8/src/test/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopTest.java) in the
jdk8 module - the class should compile and all tests will pass.
4. To verify that the Java 21 module is set up correctly,
run [CoffeeShopTest](/jdk21/src/test/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopTest.java) in the
new-java-features module - the class should compile but most tests will fail.
run [CoffeeShopTest](jdk21/src/test/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopTest.java) in the
jdk21 module - the class should compile but most tests will fail.

### Getting started
* Follow the [README](README.md) for instructions on how to complete the kata.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ public CoffeeShopOrder(String customerName, List<Item> orderItems)

/**
* Return a list of custom strings for the customer's food items!
* If the item is a Bagel: Print [bagelType] with [spreadType]
* If the item is a Cookie: Print [cookieType]
* If the item is a Donut: Print [donutType]
* The string format for each food item is as follows:
* If the item is a Bagel: "[bagelType] with [spreadType]"
* If the item is a Cookie: "[cookieType]"
* If the item is a Donut: "[donutType]"
* Otherwise: throw new IllegalStateException()
* <p>
* NOTE: This method show-cases a switch-case pattern matching.
*
* @see <a href="https://openjdk.org/jeps/441">...</a>
*/
public List<String> getFoodItemsForOrder() {
// TODO implement method
// Hint: look at the Java 8 implementation in the old-java-features module,
// TODO: implement method
// Hint: look at the Java 8 implementation in the jdk8 module,
// and the link above to see how pattern matching for switch can be utilized here
return null;
}
Expand All @@ -60,25 +62,25 @@ public List<String> getFoodItemsForOrder() {
*/
public String generateReceipt() {
// TODO: Implement the receipt generation logic here.
// Hint: look at the Java 8 implementation in the old-java-features module,
// Hint: look at the Java 8 implementation in the jdk8 module,
// and the link above to see how record patterns can be utilized here
return null;
}

/**
* 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
* First drink: Hot Americano
* Second drink: Hot Caramel Latte with Almond Milk
* Third drink: Hot Vanilla Macchiato with Whole Milk
* Fourth drink: Matcha Tea
* <p>
* 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<String> getDrinkForOrder()
{
// TODO implement method logic here
// TODO: implement method logic here
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public void setUp()
public void getFoodItemsForOrderTest()
{
// TODO: Complete the method getFoodItemsForOrder() in CoffeeShopOrder to make this pass
List<String> expected = List.of("GLAZED donut", "toasted EVERYTHING bagel with HERB_GARLIC_CREAM_CHEESE");
List<String> expected = List.of("EVERYTHING bagel with HERB_GARLIC_CREAM_CHEESE",
"CHOCOLATE_CHIP cookie", "GLAZED donut");
assertEquals(expected, coffeeShopOrder.getFoodItemsForOrder());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ public CoffeeShopOrder(String customerName, java.util.List<Item> orderItems)

/**
* Return a list of custom strings for the customer's food items!
* If the item is a Bagel: Print [bagelType] with [spreadType]
* If the item is a Cookie: Print [cookieType]
* If the item is a Donut: Print [donutType]
* The string format for each food item is as follows:
* If the item is a Bagel: "[bagelType] with [spreadType]"
* If the item is a Cookie: "[cookieType]"
* If the item is a Donut: "[donutType]"
* Otherwise: throw new IllegalStateException()
* <p>
* NOTE: This method show-cases a switch-case pattern matching.
*/
Expand All @@ -76,7 +78,7 @@ else if (item instanceof Donut)
}
else
{
throw new IllegalStateException("Unexpected value: " + item);
throw new IllegalStateException();
}
}
return foodItems;
Expand Down Expand Up @@ -126,13 +128,13 @@ else if (item instanceof Cookie)

/**
* Create and print drink order
* First drink : Hot Americano
* Second drink : Hot Caramel Latte with Almond Milk
* Third drink : Hot Vanilla Macchiato with Whole Milk
* Fourth drink : MATCHA Tea
* First drink: Hot Americano
* Second drink: Hot Caramel Latte with Almond Milk
* Third drink: Hot Vanilla Macchiato with Whole Milk
* Fourth drink: Matcha Tea
* <p>
* NOTE: Use interface to create four drinks
* Use the toString() to obtain descriptions of the dinks
* Use the toString() to obtain descriptions of the drinks
*/
public List<String> getDrinkForOrder()
{
Expand Down

0 comments on commit 6ff1649

Please sign in to comment.