Skip to content

Commit 4a74bea

Browse files
committed
Make calculator-java-cli standalone
1 parent 77f0fbd commit 4a74bea

File tree

14 files changed

+31
-29
lines changed

14 files changed

+31
-29
lines changed

.github/workflows/test-java.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
matrix:
1818
example:
1919
- calculator-java8-cli
20+
- calculator-java-cli
2021

2122
name: 'Build Java ${{ matrix.example }}'
2223
runs-on: ubuntu-latest

examples/calculator-java-cli/pom.xml renamed to calculator-java-cli/pom.xml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22
<modelVersion>4.0.0</modelVersion>
33

4-
<parent>
5-
<groupId>io.cucumber</groupId>
6-
<artifactId>examples</artifactId>
7-
<version>7.33.0-SNAPSHOT</version>
8-
</parent>
9-
4+
<groupId>io.cucumber.examples</groupId>
105
<artifactId>calculator-java-cli</artifactId>
6+
<version>0.0.1</version>
117
<packaging>jar</packaging>
8+
129
<name>Examples: Calculator - Java - Annotations - CLI</name>
1310

14-
<properties>
15-
<project.Automatic-Module-Name>io.cucumber.examples.calculator</project.Automatic-Module-Name>
16-
</properties>
17-
1811
<dependencyManagement>
1912
<dependencies>
2013
<dependency>
2114
<groupId>io.cucumber</groupId>
2215
<artifactId>cucumber-bom</artifactId>
23-
<version>${project.version}</version>
16+
<version>7.32.0</version>
2417
<type>pom</type>
2518
<scope>import</scope>
2619
</dependency>
@@ -31,6 +24,13 @@
3124
<type>pom</type>
3225
<scope>import</scope>
3326
</dependency>
27+
<dependency>
28+
<groupId>org.assertj</groupId>
29+
<artifactId>assertj-bom</artifactId>
30+
<version>3.27.6</version>
31+
<type>pom</type>
32+
<scope>import</scope>
33+
</dependency>
3434
</dependencies>
3535
</dependencyManagement>
3636

@@ -41,14 +41,13 @@
4141
<scope>test</scope>
4242
</dependency>
4343
<dependency>
44-
<groupId>org.hamcrest</groupId>
45-
<artifactId>hamcrest</artifactId>
46-
<version>2.2</version>
44+
<groupId>com.fasterxml.jackson.core</groupId>
45+
<artifactId>jackson-databind</artifactId>
4746
<scope>test</scope>
4847
</dependency>
4948
<dependency>
50-
<groupId>com.fasterxml.jackson.core</groupId>
51-
<artifactId>jackson-databind</artifactId>
49+
<groupId>org.assertj</groupId>
50+
<artifactId>assertj-core</artifactId>
5251
<scope>test</scope>
5352
</dependency>
5453
</dependencies>
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
import java.time.LocalDate;
99

10-
import static org.hamcrest.MatcherAssert.assertThat;
11-
import static org.hamcrest.Matchers.equalTo;
10+
import static org.assertj.core.api.Assertions.assertThat;
1211

1312
public class DateStepDefinitions {
1413

@@ -32,7 +31,7 @@ public void I_ask_if_date_is_in_the_past(LocalDate date) {
3231

3332
@Then("^the result should be (yes|no)$")
3433
public void the_result_should_be(String expectedResult) {
35-
assertThat(result, equalTo(expectedResult));
34+
assertThat(result).isEqualTo(expectedResult);
3635
}
3736

3837
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
import java.util.List;
1313

14-
import static org.hamcrest.MatcherAssert.assertThat;
15-
import static org.hamcrest.Matchers.equalTo;
14+
import static org.assertj.core.api.Assertions.assertThat;
1615

1716
public class RpnCalculatorStepDefinitions {
1817

@@ -57,7 +56,7 @@ public void I_press(String what) {
5756

5857
@Then("the result is {int}")
5958
public void the_result_is(double expected) {
60-
assertThat(calc.value(), equalTo(expected));
59+
assertThat(calc.value()).isEqualTo(expected);
6160
}
6261

6362
@Given("the previous entries:")
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
import java.util.stream.Stream;
1717

1818
import static io.cucumber.examples.calculator.ShoppingStepDefinitions.Price.fromString;
19-
import static org.hamcrest.MatcherAssert.assertThat;
20-
import static org.hamcrest.Matchers.equalTo;
19+
import static org.assertj.core.api.Assertions.assertThat;
2120

2221
public class ShoppingStepDefinitions {
2322

@@ -59,7 +58,7 @@ public void i_pay(Amount amount) {
5958

6059
@Then("my change should be {}")
6160
public void my_change_should_be_(int change) {
62-
assertThat(-calc.value().intValue(), equalTo(change));
61+
assertThat(-calc.value().intValue()).isEqualTo(change);
6362
}
6463

6564
@Given("the following shopping list:")
@@ -86,7 +85,7 @@ public void i_count_shopping_price() {
8685

8786
@Then("price would be {int}")
8887
public void price_would_be(int totalPrice) {
89-
assertThat(groceriesPrice, equalTo(totalPrice));
88+
assertThat(groceriesPrice).isEqualTo(totalPrice);
9089
}
9190

9291
static class Grocery {

0 commit comments

Comments
 (0)