diff --git a/pom.xml b/pom.xml
index 49784e0..9807023 100644
--- a/pom.xml
+++ b/pom.xml
@@ -123,7 +123,12 @@
jackson-annotations
2.15.3
-
+
+ org.springframework.data
+ spring-data-commons
+ 3.2.2
+
+
diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Adoptions.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoptions.java
index 5f97e86..f397141 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/domain/Adoptions.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoptions.java
@@ -1,8 +1,5 @@
package cat.udl.eps.softarch.demo.domain;
-import jakarta.persistence.Entity;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.Id;
-import jakarta.persistence.OneToOne;
+import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@@ -22,7 +19,7 @@
public class Adoptions {
@Id
- @GeneratedValue
+ @GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne
diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Permission.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Permission.java
index 53e4c36..b1fc8ff 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/domain/Permission.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Permission.java
@@ -1,6 +1,8 @@
package cat.udl.eps.softarch.demo.domain;
import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
@@ -13,6 +15,7 @@
public class Permission {
@Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotNull
diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Pet.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Pet.java
index cafe8ed..97e5bea 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/domain/Pet.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Pet.java
@@ -1,10 +1,7 @@
package cat.udl.eps.softarch.demo.domain;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.OneToOne;
+import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
@@ -22,6 +19,7 @@
public abstract class Pet extends UriEntity {
@Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotBlank
diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Role.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Role.java
index ed51a2f..f0d6346 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/domain/Role.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Role.java
@@ -1,8 +1,6 @@
package cat.udl.eps.softarch.demo.domain;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
+import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -11,10 +9,11 @@
@Table(name = "Role") // Nombre de la tabla en la base de datos
@Data
@EqualsAndHashCode(callSuper = true)
-public class Role extends UriEntity {
+public class Role extends UriEntity {
@Id
- private String id;
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private Long id;
@NotBlank
private String name;
diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java
index 2c8eb0d..1de2039 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Shelter.java
@@ -1,16 +1,14 @@
package cat.udl.eps.softarch.demo.domain;
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Pattern;
-import lombok.Data;
-import jakarta.persistence.Id;
+import com.fasterxml.jackson.annotation.JsonIdentityReference;
+import jakarta.persistence.*;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Pattern;
import jdk.jfr.BooleanFlag;
+import lombok.Data;
import lombok.EqualsAndHashCode;
-import org.hibernate.validator.constraints.Length;
import java.time.LocalDateTime;
@@ -19,7 +17,20 @@
@EqualsAndHashCode(callSuper = false)
public class Shelter extends UriEntity {
+ @ManyToOne
+ @JsonIdentityReference(alwaysAsId = true)
+ private User user;
+
+ @ManyToOne
+ @JsonIdentityReference(alwaysAsId = true)
+ private Pet pet;
+
+ @OneToOne
+ @JsonIdentityReference(alwaysAsId = true)
+ private ShelterCertificate shelterCertificate;
+
@Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotBlank
@@ -31,7 +42,7 @@ public class Shelter extends UriEntity {
private String email;
@NotBlank
- @Pattern(regexp="(^$|[0-9]{11})")
+ @Pattern(regexp="(^[+]*[(]?[0-9]{1,4}[)]?[-\\s./0-9]*$)")
private String mobile;
@NotNull
diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java b/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java
index 730f2d4..9d50754 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/domain/ShelterCertificate.java
@@ -1,9 +1,7 @@
package cat.udl.eps.softarch.demo.domain;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Id;
-import jakarta.persistence.OneToOne;
+import jakarta.persistence.*;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -20,6 +18,7 @@ public class ShelterCertificate {
private Shelter shelter;
@Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@NotNull
diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/AdoptionsRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/AdoptionsRepository.java
index 5101d0b..cdc69fb 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/repository/AdoptionsRepository.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/repository/AdoptionsRepository.java
@@ -3,6 +3,8 @@
import cat.udl.eps.softarch.demo.domain.Adoptions;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-public interface AdoptionsRepository extends CrudRepository, PagingAndSortingRepository {
+@RepositoryRestResource
+public interface AdoptionsRepository extends CrudRepository, PagingAndSortingRepository {
}
diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/CatRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/CatRepository.java
index 48c8445..e92592a 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/repository/CatRepository.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/repository/CatRepository.java
@@ -3,6 +3,8 @@
import cat.udl.eps.softarch.demo.domain.Cat;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-public interface CatRepository extends CrudRepository, PagingAndSortingRepository {
+@RepositoryRestResource
+public interface CatRepository extends CrudRepository, PagingAndSortingRepository {
}
diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/DogRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/DogRepository.java
index 5e83b4c..e068275 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/repository/DogRepository.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/repository/DogRepository.java
@@ -3,6 +3,8 @@
import cat.udl.eps.softarch.demo.domain.Dog;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-public interface DogRepository extends CrudRepository, PagingAndSortingRepository {
+@RepositoryRestResource
+public interface DogRepository extends CrudRepository, PagingAndSortingRepository {
}
diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/LocationRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/LocationRepository.java
index ea42215..e705bd3 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/repository/LocationRepository.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/repository/LocationRepository.java
@@ -4,8 +4,10 @@
import cat.udl.eps.softarch.demo.domain.User;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-public interface LocationRepository extends CrudRepository, PagingAndSortingRepository {
+@RepositoryRestResource
+public interface LocationRepository extends CrudRepository, PagingAndSortingRepository {
}
diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/PetRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/PetRepository.java
index d7edc69..0e4cbc5 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/repository/PetRepository.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/repository/PetRepository.java
@@ -3,6 +3,8 @@
import cat.udl.eps.softarch.demo.domain.Pet;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-public interface PetRepository extends CrudRepository, PagingAndSortingRepository {
+@RepositoryRestResource
+public interface PetRepository extends CrudRepository, PagingAndSortingRepository {
}
diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/RoleRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/RoleRepository.java
new file mode 100644
index 0000000..d1cf3c0
--- /dev/null
+++ b/src/main/java/cat/udl/eps/softarch/demo/repository/RoleRepository.java
@@ -0,0 +1,11 @@
+package cat.udl.eps.softarch.demo.repository;
+
+import cat.udl.eps.softarch.demo.domain.Pet;
+import cat.udl.eps.softarch.demo.domain.Role;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource
+public interface RoleRepository extends CrudRepository, PagingAndSortingRepository {
+}
diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/ScheduleRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/ScheduleRepository.java
index 9f7555f..aa60082 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/repository/ScheduleRepository.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/repository/ScheduleRepository.java
@@ -3,7 +3,9 @@
import cat.udl.eps.softarch.demo.domain.Schedule;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-public interface ScheduleRepository extends CrudRepository, PagingAndSortingRepository {
+@RepositoryRestResource
+public interface ScheduleRepository extends CrudRepository, PagingAndSortingRepository {
}
diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterCertificateRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterCertificateRepository.java
index 37f578f..a56fbc5 100644
--- a/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterCertificateRepository.java
+++ b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterCertificateRepository.java
@@ -3,7 +3,9 @@
import cat.udl.eps.softarch.demo.domain.ShelterCertificate;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-public interface ShelterCertificateRepository extends CrudRepository, PagingAndSortingRepository {
+@RepositoryRestResource
+public interface ShelterCertificateRepository extends CrudRepository, PagingAndSortingRepository {
}
\ No newline at end of file
diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java
new file mode 100644
index 0000000..65ccd1c
--- /dev/null
+++ b/src/main/java/cat/udl/eps/softarch/demo/repository/ShelterRepository.java
@@ -0,0 +1,12 @@
+package cat.udl.eps.softarch.demo.repository;
+
+import cat.udl.eps.softarch.demo.domain.Shelter;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource
+public interface ShelterRepository extends CrudRepository, PagingAndSortingRepository {
+ Shelter findByName(@Param("name") String name);
+}
\ No newline at end of file
diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/DeleteShelterStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/DeleteShelterStepDefs.java
new file mode 100644
index 0000000..4704a70
--- /dev/null
+++ b/src/test/java/cat/udl/eps/softarch/demo/steps/DeleteShelterStepDefs.java
@@ -0,0 +1,49 @@
+package cat.udl.eps.softarch.demo.steps;
+
+import cat.udl.eps.softarch.demo.domain.Shelter;
+import cat.udl.eps.softarch.demo.repository.ShelterRepository;
+import io.cucumber.java.en.And;
+import io.cucumber.java.en.When;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+
+import java.nio.charset.StandardCharsets;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
+import static org.assertj.core.api.Assertions.assertThat;
+
+
+public class DeleteShelterStepDefs {
+ @Autowired
+ private StepDefs stepDefs;
+
+ @Autowired
+ private ShelterRepository shelterRepository;
+
+ @When("^I delete the shelter with name \"([^\"]*)\"$")
+ public void iDeleteAShelterWithName(String name) throws Exception {
+ Shelter shelter = shelterRepository.findByName(name);
+
+ stepDefs.result = stepDefs.mockMvc.perform(
+ delete("/shelters/{id}", (shelter != null) ? shelter.getId() : "999")
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(stepDefs.mapper.writeValueAsString(shelter))
+ .characterEncoding(StandardCharsets.UTF_8)
+ .accept(MediaType.APPLICATION_JSON)
+ .with(AuthenticationStepDefs.authenticate()))
+ .andDo(print());
+ }
+
+ @And("^The shelter with name \"([^\"]*)\" has been deleted$")
+ public void theShelterWithNameHasBeenDeleted(String name) {
+ Shelter shelter = shelterRepository.findByName(name);
+ assertThat(shelter).isNull();
+ }
+
+ @And("^The shelter with name \"([^\"]*)\" has not been deleted$")
+ public void theShelterWithNameHasNotBeenDeleted(String name) {
+ Shelter shelter = shelterRepository.findByName(name);
+ assertThat(shelter).isNotNull();
+ }
+}
diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/GetShelterStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/GetShelterStepDefs.java
new file mode 100644
index 0000000..878f091
--- /dev/null
+++ b/src/test/java/cat/udl/eps/softarch/demo/steps/GetShelterStepDefs.java
@@ -0,0 +1,34 @@
+package cat.udl.eps.softarch.demo.steps;
+
+import cat.udl.eps.softarch.demo.domain.Shelter;
+import cat.udl.eps.softarch.demo.repository.ShelterRepository;
+import io.cucumber.java.en.When;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+
+import java.nio.charset.StandardCharsets;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
+
+public class GetShelterStepDefs {
+ @Autowired
+ private StepDefs stepDefs;
+
+ @Autowired
+ private ShelterRepository shelterRepository;
+
+ @When("^I retrieve the shelter with name \"([^\"]*)\"$")
+ public void iRetrieveShelterWithName(String name) throws Exception {
+ Shelter shelter = shelterRepository.findByName(name);
+
+ stepDefs.result = stepDefs.mockMvc.perform(
+ get("/shelters/{id}", (shelter != null) ? shelter.getId() : "999")
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(stepDefs.mapper.writeValueAsString(shelter))
+ .characterEncoding(StandardCharsets.UTF_8)
+ .accept(MediaType.APPLICATION_JSON)
+ .with(AuthenticationStepDefs.authenticate()))
+ .andDo(print());
+ }
+}
diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterStepDefs.java
new file mode 100644
index 0000000..dd91c84
--- /dev/null
+++ b/src/test/java/cat/udl/eps/softarch/demo/steps/RegisterShelterStepDefs.java
@@ -0,0 +1,84 @@
+package cat.udl.eps.softarch.demo.steps;
+
+import cat.udl.eps.softarch.demo.domain.Shelter;
+import cat.udl.eps.softarch.demo.repository.ShelterRepository;
+import io.cucumber.java.ParameterType;
+import io.cucumber.java.en.Given;
+import io.cucumber.java.en.Then;
+import io.cucumber.java.en.When;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+
+import java.nio.charset.StandardCharsets;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
+
+public class RegisterShelterStepDefs {
+
+ @Autowired
+ private StepDefs stepDefs;
+
+ @Autowired
+ private ShelterRepository shelterRepository;
+ public static String newResourceUri;
+
+ @ParameterType(value = "true|True|TRUE|false|False|FALSE")
+ public Boolean booleanValue(String value) {
+ return Boolean.valueOf(value);
+ }
+ @When("I register a new shelter with name \"([^\"]*)\", email \"([^\"]*)\", mobile \"([^\"]*)\" and isActive (True|False)$")
+ public void iRegisterANewShelterWithNameEmailMobileAndIsActive(String name, String email, String mobile, boolean isActive) throws Exception {
+ Shelter shelter = new Shelter();
+ shelter.setName(name);
+ shelter.setEmail(email);
+ shelter.setMobile(mobile);
+ shelter.setActive(isActive);
+ shelter.setCreatedAt(java.time.LocalDateTime.now());
+ shelter.setUpdatedAt(java.time.LocalDateTime.now());
+
+
+ stepDefs.result = stepDefs.mockMvc.perform(
+ post("/shelters")
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(stepDefs.mapper.writeValueAsString(shelter))
+ .characterEncoding(StandardCharsets.UTF_8)
+ .accept(MediaType.APPLICATION_JSON)
+ .with(AuthenticationStepDefs.authenticate()))
+ .andDo(print());
+
+ newResourceUri = stepDefs.result.andReturn().getResponse().getHeader("Location");
+
+ }
+
+ @Then("^It has been created a shelter with name \"([^\"]*)\", email \"([^\"]*)\", mobile \"([^\"]*)\", the isActive is not returned$")
+ public void itHasBeenCreatedAShelterWithNameEmailMobileAndTheIsActiveIsNotReturned(String name, String email, String mobile) {
+ Shelter createdShelter = shelterRepository.findByName(name);
+ assertThat(createdShelter).isNotNull();
+ assertThat(createdShelter.getEmail()).isEqualTo(email);
+ assertThat(createdShelter.getMobile()).isEqualTo(mobile);
+ }
+
+ @Then("^It has not been created a shelter with name \"([^\"]*)\"$")
+ public void itHasNotBeenCreatedAShelterWithName(String name) {
+ Shelter shelter = shelterRepository.findByName(name);
+ assertThat(shelter).isNull();
+ }
+
+
+ @Given("^There is a registered shelter with name \"([^\"]*)\", email \"([^\"]*)\", mobile \"([^\"]*)\"$")
+ public void thereIsARegisteredShelterWithNameEmailMobileAndIsActiveTrue(String name, String email, String mobile) {
+ Shelter shelter = new Shelter();
+ shelter.setName(name);
+ shelter.setEmail(email);
+ shelter.setMobile(mobile);
+ shelter.setCreatedAt(java.time.LocalDateTime.now());
+ shelter.setUpdatedAt(java.time.LocalDateTime.now());
+ shelterRepository.save(shelter);
+
+ Shelter shelter_find = shelterRepository.findByName(name);
+ assertThat(shelter_find).isNotNull();
+ }
+}
+
diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/UpdateShelterStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/UpdateShelterStepDefs.java
new file mode 100644
index 0000000..c4f265c
--- /dev/null
+++ b/src/test/java/cat/udl/eps/softarch/demo/steps/UpdateShelterStepDefs.java
@@ -0,0 +1,54 @@
+package cat.udl.eps.softarch.demo.steps;
+
+import cat.udl.eps.softarch.demo.domain.Shelter;
+import cat.udl.eps.softarch.demo.repository.ShelterRepository;
+import io.cucumber.datatable.DataTable;
+import io.cucumber.java.en.When;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Map;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
+import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
+
+public class UpdateShelterStepDefs {
+ @Autowired
+ private StepDefs stepDefs;
+
+ @Autowired
+ private ShelterRepository shelterRepository;
+
+ @When("^I update the shelter with name \"([^\"]*)\" and new attributes:$")
+ public void iUpdateShelterWithName(String name, DataTable table) throws Exception {
+ List