Skip to content

Commit

Permalink
Fix pom issues, update readme/setup and @see links
Browse files Browse the repository at this point in the history
Signed-off-by: Emilie <[email protected]>
  • Loading branch information
emilie-robichaud committed Sep 16, 2023
1 parent 99b6ab1 commit 09493c7
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 59 deletions.
16 changes: 9 additions & 7 deletions coffee-shop-kata-solutions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

Expand All @@ -32,8 +32,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
<junit5.version>5.9.3</junit5.version>
</properties>

Expand All @@ -59,10 +59,12 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<argLine>--enable-preview</argLine>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
</plugins>
Expand Down
16 changes: 11 additions & 5 deletions coffee-shop-kata/SETUP.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
## Setting up the project

### Requirements
* [JDK 21](https://jdk.java.net/21/) installed on your computer
* [JDK 20](https://jdk.java.net/20/) installed on your computer
* [Maven 3.6.1+](https://maven.apache.org/download.cgi) installed on your computer
* [IntelliJ IDEA 2023.1+](https://www.jetbrains.com/idea/download/?section=windows) or similar IDE for Java

### Project setup
1. Git clone the entire [code-katas](https://github.com/BNYMellon/CodeKatas) project from GitHub or download the project as a .zip file.
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.
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.
1. Git clone the entire [code-katas](https://github.com/BNYMellon/CodeKatas) project from GitHub or download the project
as a .zip file.
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.
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.

### Getting started
* Follow the [README](README.md) for instructions on how to complete the kata.
40 changes: 33 additions & 7 deletions coffee-shop-kata/jdk21/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
Expand All @@ -29,17 +29,43 @@
<artifactId>jdk21</artifactId>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</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-api</artifactId>
<version>5.10.0</version>
<scope>test</scope>
<artifactId>junit-jupiter</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public CoffeeShopOrder(String customerName, List<Item> orderItems)
* If the item is a Donut: Print [donutType]
* <p>
* NOTE: This method show-cases a switch-case pattern matching.
* @see https://openjdk.org/jeps/441
*
* @see <a href="https://openjdk.org/jeps/441">...</a>
*/
public List<String> getFoodItemsForOrder() {
// TODO implement method
Expand All @@ -55,12 +56,13 @@ public List<String> getFoodItemsForOrder() {
* Total: $Total Price
* <p>
* NOTE: The method highlights the usage of a record deconstruction pattern
* @see https://openjdk.org/jeps/440
*
* @see <a href="https://openjdk.org/jeps/440">...</a>
*/
public String generateReceipt() {
// TODO: Implement the receipt generation logic here.
// Hint: look at the Java 8 implementation in the old-java-features module,
// and the link above to see how record patterns can be utilitzed here
// and the link above to see how record patterns can be utilized here
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

/**
* TODO: convert class to record
* @see https://openjdk.org/jeps/395
*
* @see <a href="https://openjdk.org/jeps/395">...</a>
*/
public class Bagel implements BakeryItem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@

package bnymellon.codekatas.coffeeshopkata.food;

import bnymellon.codekatas.coffeeshopkata.food.BakeryItem;
import bnymellon.codekatas.coffeeshopkata.food.CookieType;

import java.util.Objects;

/**
* TODO: convert class to record
* @see https://openjdk.org/jeps/395
*
* @see <a href="https://openjdk.org/jeps/395">...</a>
*/
public class Cookie implements BakeryItem
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

import java.util.Objects;

/**
* TODO: convert class to record
*
* @see <a href="https://openjdk.org/jeps/395">...</a>
*/
public class Donut implements BakeryItem
{
private final DonutType donutType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void testDonutGetters()
@Test
public void testSealedClasses()
{
//TODO Convert Coffee Drink to sealed class
// TODO: Convert Coffee Drink to sealed class
assertTrue(CoffeeDrink.class.isSealed());
assertFalse(Americano.class.isSealed());
assertFalse(Macchiato.class.isSealed());
Expand All @@ -145,7 +145,7 @@ public void testSealedClasses()
@Test
public void getDrinkItems()
{
//TODO Complete the method getDrinkForOrder() in CoffeeShopOrder to make this pass
// TODO: Complete the method getDrinkForOrder() in CoffeeShopOrder to make this pass
List<String> expected = List.of("HOT Americano", "HOT CARAMEL Latte with ALMOND_MILK",
"HOT VANILLA Macchiato with WHOLE_MILK", "MATCHA Tea");
assertEquals(expected, coffeeShopOrder.getDrinkForOrder());
Expand Down
9 changes: 5 additions & 4 deletions coffee-shop-kata/jdk8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
Expand All @@ -32,13 +32,14 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit5.version>5.9.3</junit5.version>
</properties>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.0</version>
<artifactId>junit-jupiter</artifactId>
<version>${junit5.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

import java.util.Objects;

/**
* TODO: convert class to record
* @see https://openjdk.org/jeps/395
*/
public class Donut implements BakeryItem
{
private final DonutType donutType;
Expand Down
25 changes: 3 additions & 22 deletions coffee-shop-kata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
~ limitations under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

Expand All @@ -25,7 +25,7 @@

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

<name>coffee-shop-kata</name>
<name>Coffee Shop Kata</name>
<packaging>pom</packaging>

<properties>
Expand All @@ -37,23 +37,4 @@
<module>jdk21</module>
</modules>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

0 comments on commit 09493c7

Please sign in to comment.