Skip to content

Commit ab8939b

Browse files
junit version for serenity
1 parent 7086b92 commit ab8939b

File tree

8 files changed

+68
-24
lines changed

8 files changed

+68
-24
lines changed

Diff for: model-api/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<dependencies>
1919
<!-- Junit -->
2020
<dependency>
21-
<groupId>org.junit.vintage</groupId>
22-
<artifactId>junit-vintage-engine</artifactId>
21+
<groupId>junit</groupId>
22+
<artifactId>junit</artifactId>
2323
<scope>test</scope>
2424
</dependency>
2525
<!-- POJO Tester -->

Diff for: model-bdd/src/main/resources/api/bdd/features/RetrieveClient.feature

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Scenario: Retrieve a valid client
99
Then User gets "ORG1" client
1010

1111
Scenario: Retrieve an invalid client
12-
When User retrieves client "notfound"
13-
Then User gets client exception for "notfound"
12+
When User retrieves a client that does not exist
13+
Then User gets client not found exception for retrieve
1414

1515
Scenario: Retrieve a client has a system error
16-
When User retrieves client "error"
17-
Then User gets service exception for "error"
16+
When User retrieves client that causes a service exception
17+
Then User gets service exception for retrieve
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Feature: Update client details
2+
User wants to update a client
3+
4+
Background: Client service available
5+
Given A client update service is available
6+
7+
Scenario: Update a client
8+
When User retrieves client "ORG1"
9+
And User updates client name to "foo"
10+
And User submits client "ORG1"
11+
Then User gets updated client "ORG1"
12+
13+
Scenario: Update a client with validation error
14+
When User retrieves client "ORG1"
15+
And User updates client name to blank
16+
And User submits client "ORG1"
17+
Then User gets validation exception for "ORG1"
18+
19+
Scenario: Update an invalid client
20+
When User submits a client that does not exist
21+
Then User gets client not found exception for update
22+
23+
Scenario: Update a client has a system error
24+
When User retrieves client "ORG1"
25+
And User submits a client that receives a service exception
26+
Then User gets service exception for update

Diff for: model-mock-impl/pom.xml

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
<dependency>
5050
<groupId>junit</groupId>
5151
<artifactId>junit</artifactId>
52-
<version>4.12</version>
5352
<scope>test</scope>
5453
</dependency>
5554

Diff for: model-mock-impl/src/test/java/com/sample/app/model/bdd/steps/RetrieveApplicationSteps.java renamed to model-mock-impl/src/test/java/com/sample/app/model/bdd/steps/RetrieveClientSteps.java

+22-12
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,29 @@
55
import com.sample.app.model.exception.ServiceException;
66
import com.sample.app.model.impl.ClientServicesMockImpl;
77
import com.sample.app.model.services.ClientServices;
8-
import cucumber.api.java.en.Given;
9-
import cucumber.api.java.en.Then;
10-
import cucumber.api.java.en.When;
8+
import io.cucumber.java.en.Given;
9+
import io.cucumber.java.en.Then;
10+
import io.cucumber.java.en.When;
1111
import org.junit.Assert;
1212

1313
/**
1414
* Retrieve client steps.
1515
*/
16-
public class RetrieveApplicationSteps {
16+
public class RetrieveClientSteps {
1717

1818
private final ClientServices backing = new ClientServicesMockImpl();
1919

2020
private ClientDetail client;
2121
private Exception error;
2222

2323
@Given("A client retrieve service is available")
24-
public void wantToRetrieveApplication() {
24+
public void wantToRetrieveClient() {
2525
this.error = null;
2626
this.client = null;
2727
}
2828

2929
@When("User retrieves client {string}")
30-
public void retrieveApplication(final String id) {
30+
public void retrieveClient(final String id) {
3131
client = null;
3232
error = null;
3333
try {
@@ -37,20 +37,30 @@ public void retrieveApplication(final String id) {
3737
}
3838
}
3939

40+
@When("User retrieves a client that does not exist")
41+
public void retrieveClientNotExists() {
42+
retrieveClient("notfound");
43+
}
44+
45+
@When("User retrieves client that causes a service exception")
46+
public void retrieveClientCausesError() {
47+
retrieveClient("error");
48+
}
49+
4050
@Then("User gets {string} client")
4151
public void shouldHaveApplication(final String id) {
4252
Assert.assertNotNull("Client should have been retrieved", client);
4353
Assert.assertEquals("Incorrect client id retrieved", id, client.getClientId());
4454
}
4555

46-
@Then("User gets client exception for {string}")
47-
public void shouldHaveApplicationException(final String id) {
48-
Assert.assertTrue("Service should have created not found exception", error instanceof ClientNotFoundException);
56+
@Then("User gets client not found exception for retrieve")
57+
public void shouldHaveClientNotFoundException() {
58+
Assert.assertTrue("Service should have caused client not found exception", error instanceof ClientNotFoundException);
4959
}
5060

51-
@Then("User gets service exception for {string}")
52-
public void shouldHaveServiceException(final String id) {
53-
Assert.assertTrue("Service should have created service exception", error instanceof ServiceException);
61+
@Then("User gets service exception for retrieve")
62+
public void shouldHaveServiceException() {
63+
Assert.assertTrue("Service should have caused service exception", error instanceof ServiceException);
5464
}
5565

5666
}

Diff for: pom.xml

+8
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@
223223
<version>0.8.13</version>
224224
</dependency>
225225

226+
<!-- Serenity & Cucumber only work with junit 4 (and not vintage junit 5) -->
227+
<dependency>
228+
<groupId>junit</groupId>
229+
<artifactId>junit</artifactId>
230+
<version>4.12</version>
231+
<scope>test</scope>
232+
</dependency>
233+
226234
</dependencies>
227235
</dependencyManagement>
228236

Diff for: rest-api/pom.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@
4343
<scope>provided</scope>
4444
</dependency>
4545

46+
<!-- Junit -->
4647
<dependency>
47-
<groupId>org.junit.vintage</groupId>
48-
<artifactId>junit-vintage-engine</artifactId>
48+
<groupId>junit</groupId>
49+
<artifactId>junit</artifactId>
4950
<scope>test</scope>
5051
</dependency>
5152

Diff for: web-ui/pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@
6060
<dependency>
6161
<groupId>commons-logging</groupId>
6262
<artifactId>commons-logging</artifactId>
63-
<version>1.2</version>
6463
</dependency>
6564

65+
<!-- Junit -->
6666
<dependency>
67-
<groupId>org.junit.vintage</groupId>
68-
<artifactId>junit-vintage-engine</artifactId>
67+
<groupId>junit</groupId>
68+
<artifactId>junit</artifactId>
6969
<scope>test</scope>
7070
</dependency>
7171

0 commit comments

Comments
 (0)