diff --git a/diagram.svg b/diagram.svg
index dfb5ff3..c03813a 100644
--- a/diagram.svg
+++ b/diagram.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index f669143..d89de70 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -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]
diff --git a/src/bdd-test/java/com/arc_e_tect/blog/phonebook/web/contacts/ContactSteps.java b/src/bdd-test/java/com/arc_e_tect/blog/phonebook/web/contacts/ContactSteps.java
index 95fdba9..36996b6 100644
--- a/src/bdd-test/java/com/arc_e_tect/blog/phonebook/web/contacts/ContactSteps.java
+++ b/src/bdd-test/java/com/arc_e_tect/blog/phonebook/web/contacts/ContactSteps.java
@@ -13,6 +13,7 @@
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.result.DeleteResult;
+import com.mongodb.client.result.InsertOneResult;
import io.cucumber.java.Before;
import io.cucumber.java.DataTableType;
import io.cucumber.java.en.Given;
@@ -26,6 +27,7 @@
import org.springframework.http.HttpStatus;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -48,6 +50,28 @@ public class ContactSteps {
CodecRegistry pojoCodecRegistry;
MongoCollection collection;
+ public static String contactPostTemplate =
+ """
+ {"id":%d,"name":"%s","phone":"%s"}
+ """;
+ public static String contactPostNameNullTemplate =
+ """
+ {"id":%d,"name":null,"phone":"%s"}
+ """;
+ public static String contactPatchPhoneTemplate =
+ """
+ {"id":%d,"phone":"%s"};
+ """;
+
+ public static String contactPatchNameTemplate =
+ """
+ {"id":%d,"name":"%s"};
+ """;
+ public static String contactPatchNamePhoneTemplate =
+ """
+ {"id":%d,"name":"%s","phone":"%s"};
+ """;
+
private long contactId = 1;
private TestContact contact;
@@ -74,32 +98,35 @@ public void the_phonebook_is_empty() {
collection.drop();
}
- @Given("the contact with name {string} is listed in the phonebook")
- public void the_contact_with_name_is_listed_in_the_phonebook(String name) {
- TestContact newContact = new TestContact();
- newContact.setName(name);
- newContact.setId(contactId++);
- collection.insertOne(newContact);
- }
+ @Given("the listed contact(s)")
+ public void the_listed_contacts(io.cucumber.datatable.DataTable dataTable) {
+ int contactId=0;
+ List