Skip to content

Commit

Permalink
Coffee shop kata project structure
Browse files Browse the repository at this point in the history
Signed-off-by: Aqsa Malik <aqsa.malik@bnymellon.com>
  • Loading branch information
aqsa505 committed Sep 15, 2023
1 parent 720e906 commit 9e0c473
Show file tree
Hide file tree
Showing 71 changed files with 253 additions and 267 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/solutions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Maven
run: mvn -pl calendar-kata-solutions,code-point-kata-solutions,deck-of-cards-kata-solutions,donut-kata-solutions,java-lambda-kata-solutions,pitest-mutation-kata-solutions,coffee-shop-kata-solutions/new-java-features-solutions,kata-of-katas-solutions verify -Dmaven.javadoc.skip=true -B -V --no-transfer-progress
run: mvn -pl calendar-kata-solutions,code-point-kata-solutions,deck-of-cards-kata-solutions,donut-kata-solutions,java-lambda-kata-solutions,pitest-mutation-kata-solutions,coffee-shop-kata-solutions,kata-of-katas-solutions verify -Dmaven.javadoc.skip=true -B -V --no-transfer-progress
env:
MAVEN_OPTS: "-Dmaven.repo.local=$HOME/.m2/repository -Xmx1g -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS"
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
<modelVersion>4.0.0</modelVersion>

<groupId>bnymellon.codekatas</groupId>
<version>1.0.0</version>
<artifactId>new-java-features-solutions</artifactId>
<version>1.0.0-SNAPSHOT</version>

<artifactId>coffee-shop-kata-solutions</artifactId>

<name>Coffee Shop Kata Solutions</name>
<description>
Expand All @@ -31,35 +32,35 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<junit5.version>5.9.3</junit5.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit5.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit5.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>21</source>
<target>21</target>
</configuration>
<version>3.11.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<version>3.1.2</version>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata;
package bnymellon.codekatas.coffeeshopkata;

import bnymellon.codekatas.coffeekata.beverage.Americano;
import bnymellon.codekatas.coffeekata.beverage.CoffeeDrink;
import bnymellon.codekatas.coffeekata.beverage.DrinkTemperature;
import bnymellon.codekatas.coffeekata.beverage.FlavorSyrup;
import bnymellon.codekatas.coffeekata.beverage.Latte;
import bnymellon.codekatas.coffeekata.beverage.Macchiato;
import bnymellon.codekatas.coffeekata.beverage.MilkType;
import bnymellon.codekatas.coffeekata.beverage.Tea;
import bnymellon.codekatas.coffeekata.beverage.TeaType;
import bnymellon.codekatas.coffeekata.food.Bagel;
import bnymellon.codekatas.coffeekata.food.BagelType;
import bnymellon.codekatas.coffeekata.food.Cookie;
import bnymellon.codekatas.coffeekata.food.CookieType;
import bnymellon.codekatas.coffeekata.food.Donut;
import bnymellon.codekatas.coffeekata.food.DonutType;
import bnymellon.codekatas.coffeekata.food.SpreadType;
import bnymellon.codekatas.coffeeshopkata.beverage.Americano;
import bnymellon.codekatas.coffeeshopkata.beverage.CoffeeDrink;
import bnymellon.codekatas.coffeeshopkata.beverage.DrinkTemperature;
import bnymellon.codekatas.coffeeshopkata.beverage.FlavorSyrup;
import bnymellon.codekatas.coffeeshopkata.beverage.Latte;
import bnymellon.codekatas.coffeeshopkata.beverage.Macchiato;
import bnymellon.codekatas.coffeeshopkata.beverage.MilkType;
import bnymellon.codekatas.coffeeshopkata.beverage.Tea;
import bnymellon.codekatas.coffeeshopkata.beverage.TeaType;
import bnymellon.codekatas.coffeeshopkata.food.Bagel;
import bnymellon.codekatas.coffeeshopkata.food.BagelType;
import bnymellon.codekatas.coffeeshopkata.food.Cookie;
import bnymellon.codekatas.coffeeshopkata.food.CookieType;
import bnymellon.codekatas.coffeeshopkata.food.Donut;
import bnymellon.codekatas.coffeeshopkata.food.DonutType;
import bnymellon.codekatas.coffeeshopkata.food.SpreadType;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata;
package bnymellon.codekatas.coffeeshopkata;

public interface Item
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

public final class Americano implements CoffeeDrink
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

import bnymellon.codekatas.coffeekata.Item;
import bnymellon.codekatas.coffeeshopkata.Item;

public interface Beverage extends Item
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

/**
* Prior to Java 15, a class was either declared as 'final' or left 'open,'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

public enum DrinkTemperature
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

public enum FlavorSyrup
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

public final class Latte implements CoffeeDrink
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

public non-sealed class Macchiato implements CoffeeDrink
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

public enum MilkType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

public class Tea implements Beverage
{
Expand All @@ -31,14 +31,14 @@ public double getPrice()
return 1.50;
}

public TeaType getTeaType()
{
return teaType;
}

@Override
public String toString()
{
return teaType + " " + "Tea";
}

public TeaType getTeaType()
{
return teaType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.beverage;
package bnymellon.codekatas.coffeeshopkata.beverage;

public enum TeaType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.food;
package bnymellon.codekatas.coffeeshopkata.food;

public record Bagel(BagelType bagelType, SpreadType spreadType, boolean toasted) implements BakeryItem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.food;
package bnymellon.codekatas.coffeeshopkata.food;

public enum BagelType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.food;
package bnymellon.codekatas.coffeeshopkata.food;

import bnymellon.codekatas.coffeekata.Item;
import bnymellon.codekatas.coffeeshopkata.Item;

public interface BakeryItem extends Item
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.food;
package bnymellon.codekatas.coffeeshopkata.food;

public record Cookie(CookieType cookieType, boolean warmed) implements BakeryItem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.food;
package bnymellon.codekatas.coffeeshopkata.food;

public enum CookieType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.food;
package bnymellon.codekatas.coffeeshopkata.food;

public record Donut(DonutType donutType) implements BakeryItem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.food;
package bnymellon.codekatas.coffeeshopkata.food;

public enum DonutType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package bnymellon.codekatas.coffeekata.food;
package bnymellon.codekatas.coffeeshopkata.food;

public enum SpreadType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,26 @@
* limitations under the License.
*/

import bnymellon.codekatas.coffeekata.CoffeeShopOrder;
import bnymellon.codekatas.coffeekata.Item;
import bnymellon.codekatas.coffeekata.beverage.Americano;
import bnymellon.codekatas.coffeekata.beverage.CoffeeDrink;
import bnymellon.codekatas.coffeekata.beverage.Latte;
import bnymellon.codekatas.coffeekata.beverage.Macchiato;
import bnymellon.codekatas.coffeekata.food.Bagel;
import bnymellon.codekatas.coffeekata.food.Cookie;
import bnymellon.codekatas.coffeekata.food.Donut;
package bnymellon.codekata.coffeeshopkata;

import bnymellon.codekatas.coffeeshopkata.CoffeeShopOrder;
import bnymellon.codekatas.coffeeshopkata.Item;
import bnymellon.codekatas.coffeeshopkata.beverage.Americano;
import bnymellon.codekatas.coffeeshopkata.beverage.CoffeeDrink;
import bnymellon.codekatas.coffeeshopkata.beverage.Latte;
import bnymellon.codekatas.coffeeshopkata.beverage.Macchiato;
import bnymellon.codekatas.coffeeshopkata.food.Bagel;
import bnymellon.codekatas.coffeeshopkata.food.Cookie;
import bnymellon.codekatas.coffeeshopkata.food.Donut;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.List;

import static bnymellon.codekatas.coffeekata.food.BagelType.EVERYTHING;
import static bnymellon.codekatas.coffeekata.food.CookieType.CHOCOLATE_CHIP;
import static bnymellon.codekatas.coffeekata.food.DonutType.GLAZED;
import static bnymellon.codekatas.coffeekata.food.SpreadType.HERB_GARLIC_CREAM_CHEESE;
import static bnymellon.codekatas.coffeeshopkata.food.BagelType.EVERYTHING;
import static bnymellon.codekatas.coffeeshopkata.food.CookieType.CHOCOLATE_CHIP;
import static bnymellon.codekatas.coffeeshopkata.food.DonutType.GLAZED;
import static bnymellon.codekatas.coffeeshopkata.food.SpreadType.HERB_GARLIC_CREAM_CHEESE;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down
26 changes: 13 additions & 13 deletions coffee-shop-kata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ Java features while comparing them with older.

The domain for the kata is a Coffee Shop. There are several domain
classes that are shared by all the exercises. These are
[`Items`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/Item.java),
[`CoffeeShopOrder`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/CoffeeShopOrder.java),
[`Beverage`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/beverage/Beverage.java),
[`Tea`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/beverage/Tea.java),
[`CoffeeDrink`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/beverage/CoffeeDrink.java),
[`Latte`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/beverage/Latte.java),
[`Macchiato`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/beverage/Macchiato.java),
[`Americano`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/beverage/Americano.java),
[`BakeryItem`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/food/BakeryItem.java),
[`Cookie`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/food/Cookie.java),
[`Bagel`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/food/Bagel.java), and
[`Donut`](./old-java-features/src/main/java/bnymellon/codekatas/coffeekata/food/Donut.java).
[`Items`](src/main/java/bnymellon/codekatas/coffeeshopkata/Item.java),
[`CoffeeShopOrder`](src/main/java/bnymellon/codekatas/coffeeshopkata/CoffeeShopOrder.java),
[`Beverage`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/Beverage.java),
[`Tea`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/Tea.java),
[`CoffeeDrink`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/CoffeeDrink.java),
[`Latte`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/Latte.java),
[`Macchiato`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/Macchiato.java),
[`Americano`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/beverage/Americano.java),
[`BakeryItem`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/food/BakeryItem.java),
[`Cookie`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Cookie.java),
[`Bagel`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Bagel.java), and
[`Donut`](jdk8/src/main/java/bnymellon/codekatas/coffeeshopkata/food/Donut.java).

![Diagram](CoffeeShopDomain.png)

## Getting Started ##
This kata involves refactoring existing code and implementing missing code! In the [`new-java-features`](./new-java-features) module, you will find a test class called [CoffeeShopTest](./new-java-features/src/test/java/CoffeeShopTest.java). Each test case contains a TODO that needs to be completed in order to make the code pass. All the code you need to complete is in the [`new-java-features`](./new-java-features) module, with the corresponding solutions in [`coffee-shop-kata-solutions/new-java-features`](../coffee-shop-kata-solutions/new-java-features-solutions). The purpose of the [`old-java-features`](./old-java-features) module is to show you the Java 8 way of solving these problems; there are no TODOs in this module. For technical setup, follow the instructions in [`SETUP.md`](./SETUP.md)!
This kata involves refactoring existing code and implementing missing code! In the [`new-java-features`](./new-java-features) module, you will find a test class called [bnymellon.codekata.coffeeshopkata.CoffeeShopTest](src/test/java/bnymellon/codekata/coffeeshopkata/jdk21/bnymellon.codekata.coffeeshopkata.CoffeeShopTest.java). Each test case contains a TODO that needs to be completed in order to make the code pass. All the code you need to complete is in the [`new-java-features`](./new-java-features) module, with the corresponding solutions in [`coffee-shop-kata-solutions/new-java-features`](../coffee-shop-kata-solutions/new-java-features-solutions). The purpose of the [`old-java-features`](./old-java-features) module is to show you the Java 8 way of solving these problems; there are no TODOs in this module. For technical setup, follow the instructions in [`SETUP.md`](./SETUP.md)!
Loading

0 comments on commit 9e0c473

Please sign in to comment.