Skip to content

Commit

Permalink
Merge pull request #81 from Arc-E-Tect/refresh-versions
Browse files Browse the repository at this point in the history
Upgrade gradle dependencies
  • Loading branch information
Arc-E-Tect authored Jul 31, 2023
2 parents fd31331 + f95d747 commit 1366c4a
Show file tree
Hide file tree
Showing 17 changed files with 410 additions and 329 deletions.
2 changes: 1 addition & 1 deletion diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ nebula-lint = { id = "nebula.lint", version = "_" }
spring-boot = "3.0.6"
## ⬆ = "3.0.7"
## ⬆ = "3.0.8"
## ⬆ = "3.0.9"
## ⬆ = "3.1.0"
## ⬆ = "3.1.1"
## ⬆ = "3.1.2"
spring-restdocs = "3.0.0"

[libraries]
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ public void getAll() throws IOException {
}

public void getSingleByName(String name) throws IOException {
String url = String.format("%s/%s", apiEndpoint(), name);
String url = String.format("%s?contactName=%s", apiEndpoint(), name);
executeGet(url);
}

public void getSingleById(long id) throws IOException {
String url = String.format("%s/%d", apiEndpoint(), id);
executeGet(url);
}

Expand All @@ -71,15 +76,18 @@ public void postNewContact(long id, String jsonDoc) {
executePost(apiEndpoint(), jsonDoc);
}

public void patchContact(String name, ContactResource resource) throws JsonProcessingException {
String url = String.format("%s/%s", apiEndpoint(), name);
String jsonDocument = new ObjectMapper().writeValueAsString(resource);

public void patchContact(long id, String jsonDocument) throws JsonProcessingException {
String url = String.format("%s/%d", apiEndpoint(), id);
executePatch(url, jsonDocument);
}

public void deleteContact(String contactName) {
String url = String.format("%s/%s", apiEndpoint(), contactName);
public void deleteContactByName(String contactName) {
String url = String.format("%s?contactName=%s", apiEndpoint(), contactName);
executeDelete(url);
}

public void deleteContactById(Integer contactId) {
String url = String.format("%s/%d", apiEndpoint(), contactId);
executeDelete(url);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
Feature: Add a contact to the phonebook

Scenario: 01 - A new contact
Given the contact with name "Peter Parker" is not listed in the phonebook
When the contact is added to the phonebook
| name | phone |
| Peter Parker | +1 (555) 432748 |
Then the phonebook contains the contact with name "Peter Parker"
And the contact with name "Peter Parker" has phone number "+1 (555) 432748"
And the response contains the contact with name "Peter Parker"
And the response contains the contact with phone "+1 (555) 432748"
Given the phonebook is empty
When adding to the phonebook the contact
| id | name | phone |
| 42 | Peter Parker | +1 (555) 432748 |
Then the response contains the new contact "Peter Parker" with phone "+1 (555) 432748"

Scenario: 02 - A contact with no name
When the contact with no name is added to the phonebook
Then the phonebook does not contain a contact with no name
And the response is an error indicating that invalid contact data was provided
Scenario: 02 - A new contact without a phone
Given the phonebook is empty
When adding to the phonebook the contact
| id | name | phone |
| 42 | Peter Parker | [blank] |
Then the response contains the new contact "Peter Parker" with phone ""

Scenario: 03 - A contact with an empty string as name
When the contact with name "" is added to the phonebook
Then the phonebook does not contain a contact with no name
And the response is an error indicating that invalid contact data was provided

Scenario: 04 - An already listed contact
Given the contact with name "John Smith" is listed in the phonebook
When the contact with name "John Smith" is added to the phonebook
Then the response is an error indicating that a contact with the same name already exists
Scenario: 03 - A contact with the same name as a listed Contact
Given the listed contact
| id | name | phone |
| 42 | Peter Parker | +1 (555) 748432 |
When adding to the phonebook the contact
| id | name | phone |
| 1 | Peter Parker | +1 (555) 432748 |
Then the response contains the new contact "Peter Parker" with phone "+1 (555) 432748"

@ignore
Scenario: 04 - An already listed contact
@error
Scenario: 04 - A contact with the same id as a listed Contact
Given the listed contact
| name | phone |
| Peter Parker | +1 (555) 748432 |
When the contact is added to the phonebook
| name | phone |
| Peter Parker | +1 (555) 432748 |
Then the phonebook contains the contact with name "Peter Parker"
And the contact with name "Peter Parker" has phone number "+1 (555) 432748"
And the response contains the contact with name "Peter Parker"
| id | name | phone |
| 42 | Peter Parker | +1 (555) 748432 |
When adding to the phonebook the contact
| id | name | phone |
| 42 | Peter Parker | +1 (555) 432748 |
Then the response is an error indicating that the contact already exists

Scenario: 05 - A new contact
Given the contact with name "Peter Parker" is not listed in the phonebook
When the contact is added to the phonebook
| name | phone |
| Peter Parker | |
Then the phonebook contains the contact with name "Peter Parker"
And the contact with name "Peter Parker" has no phone number
And the response contains the contact with name "Peter Parker"
@error
Scenario: 05 - A contact without an empty name is added
Given the phonebook is empty
When adding to the phonebook the contact
| id | name | phone |
| 42 | [blank] | +1 (555) 432748 |
Then the response is an error indicating that the contact details are invalid

@error
Scenario: 06 - A contact without a name is added
Given the phonebook is empty
When adding to the phonebook the contact
| id | name | phone |
| 42 | | +1 (555) 432748 |
Then the response is an error indicating that the contact details are invalid
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,30 @@ Feature: Delete a Contact from the phonebook
This feature-file specifies the scenarios related to deleting a single contact from the Arc-E-Tect Phonebook.

Scenario: 01 - A listed contact
Given the contact with name "John Smith" is listed in the phonebook
When the contact with name "John Smith" is deleted
Then the phonebook does not contain the contact with name "John Smith"
Given the listed contact
| id | name | | phone |
| 1 | Peter Parker | | +1 (555) 748432 |
When the contact with name "Peter Parker" is deleted
Then the phonebook does not contain a contact with name "Peter Parker"

Scenario: 02 - An unlisted contact
Given the contact with name "John Doe" is not listed in the phonebook
When the contact with name "John Doe" is deleted
Then the phonebook does not contain the contact with name "John Doe"
Given the phonebook does not contain a contact with name "Peter Parker"
When the contact with name "Peter Parker" is deleted
Then the phonebook does not contain a contact with name "Peter Parker"

Scenario: 03 - Multiple listed contacts with the same name
Given the listed contacts
| id | name | | phone |
| 1 | Peter Parker | | +1 (555) 748432 |
| 2 | Peter Parker | | +1 (555) 234947 |
When the contact with name "Peter Parker" is deleted
Then the phonebook does not contain a contact with name "Peter Parker"

Scenario: 04 - Multiple listed contacts with the same name
Given the listed contacts
| id | name | | phone |
| 1 | Peter Parker | | +1 (555) 748432 |
| 2 | Peter Parker | | +1 (555) 234947 |
When the contact with id 2 is deleted
Then the phonebook does not contain a contact with id 2

Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,43 @@ Feature: Get a single contact from the phonebook
This feature-file specifies the scenarios related to retrieving a single contact from the Arc-E-Tect Phonebook.

Scenario: 01 - A contact that is listed
Given the contact with name "John Smith" is listed in the phonebook
When the contact with name "John Smith" is requested
Then the response contains the contact with name "John Smith"
Given the listed contact
| id | name | phone |
| 1 | Peter Parker | +1 (555) 748432 |
When the contact with name "Peter Parker" is requested
Then the response contains a contact "Peter Parker" with phone "+1 (555) 748432"

Scenario: 02 - A contact from an empty phonebook
Scenario: 02 - A contact from an empty Phonebook
Given the phonebook is empty
When the contact with name "Peter Parker" is requested
Then the contact cannot be found
And the response contains no contact

Scenario: 03 - A contact that is not listed
Given the contact with name "John Doe" is not listed in the phonebook
When the contact with name "John Doe" is requested
Then the contact cannot be found
And the response contains no contact
Then 0 contacts are retrieved

Scenario: 03 - Multiple Contacts with the same name
Given the listed contacts
| id | name | phone |
| 1 | Peter Parker | +1 (555) 748432 |
| 2 | Peter Parker | +1 (555) 234847 |
| 3 | Charly Brown | |
When the contact with name "Peter Parker" is requested
Then the response contains a contact "Peter Parker" with phone "+1 (555) 748432"
And the response contains a contact "Peter Parker" with phone "+1 (555) 234847"

Scenario: 04 - A contact that is listed
Given the listed contact
| id | name | phone |
| 1 | Peter Parker | +1 (555) 748432 |
When the contact with id 1 is requested
Then the response contains a single contact with id 1

@error
Scenario: 05 - A contact from an empty phonebook
Given the phonebook is empty
When the contact with id 1 is requested
Then the response is an error indicating that the contact could not be found

@error
Scenario: 06 - A contact that is not listed
Given the contact with id 666 is not listed in the phonebook
When the contact with id 666 is requested
Then the response is an error indicating that the contact could not be found

Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ Feature: Get all contacts available in the phonebook
Scenario: 01 - From an empty phonebook
Given the phonebook is empty
When all contacts are requested
Then the response contains no contacts
Then 0 contacts are retrieved

Scenario: 02 - From a phonebook with a single contact in it
Given the contact with name "John Smith" is listed in the phonebook
Scenario: 02 - From a phonebook with several contacts with the same name in it
Given the listed contacts
| id | name | phone |
| 1 | Peter Parker | +1 (555) 748432 |
| 2 | Peter Parker | +1 (555) 234947 |
When all contacts are requested
Then the response contains the contact "John Smith"
Then 2 contacts are retrieved
And the response contains a contact "Peter Parker" with phone "+1 (555) 748432"
And the response contains a contact "Peter Parker" with phone "+1 (555) 234947"

Scenario: 03 - From a phonebook with several contacts in it
Given the contact with name "John Smith" is listed in the phonebook
And the contact with name "Jane Brown" is listed in the phonebook
When all contacts are requested
Then the response contains the contact "John Smith"
And the response contains the contact "Jane Brown"
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,26 @@ Feature: Update a contact in the phonebook

Scenario: 01 - Update the contact's phone number
Given the listed contact
| name | phone |
| John Smith | +1 (555) 748432 |
When the phone number of contact "John Smith" is changed to "+1 (555) 432748"
Then the contact with name "John Smith" has phone number "+1 (555) 432748"
| id | name | phone |
| 1 | Peter Parker | +1 (555) 748432 |
When the phone number of contact 1 is changed to "+1 (555) 432748"
Then the response contains the contact "Peter Parker" with phone "+1 (555) 432748"

@ignore
Scenario: 02 - Update the contact's name
Given the listed contact
| name | phone |
| John Smith | +1 (555) 748432 |
When the name of contact "John Smith" is changed to "John Stark"
Then the contact with phone "+1 (555) 748432" has name "John Stark"

Scenario: 02 - Update the contact's name
Given the listed contact
| name | phone |
| John Smith | +1 (555) 748432 |
When the name of contact "John Smith" is changed to "John Stark"
Then the contact formerly known as "John Smith" now has name "John Stark"
| id | name | phone |
| 1 | Peter Parker | +1 (555) 748432 |
When the name of contact 1 is changed to "John Stark"
Then the response contains the contact "John Stark" with phone "+1 (555) 748432"

@error
Scenario: 03 - Update a Contact in an empty phonebook
Given the phonebook is empty
When the phone number of contact "Peter Parker" is changed to "+1 (555) 432748"
Then the contact cannot be found
And the response contains no contact
When the phone number of contact 1 is changed to "+1 (555) 432748"
Then the response is an error indicating that the contact could not be found

@error
Scenario: 04 - Update an unlisted Contact
Given the contact with name "John Doe" is not listed in the phonebook
When the phone number of contact "John Doe" is changed to "+1 (555) 432748"
Then the contact cannot be found
And the response contains no contact
Given the contact with id 1 is not listed in the phonebook
When the phone number of contact 1 is changed to "+1 (555) 432748"
Then the response is an error indicating that the contact could not be found
Loading

0 comments on commit 1366c4a

Please sign in to comment.