-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from UdL-EPS-SoftArch/Feature-View-pet-catalogue
Feature view pet catalogue
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/test/java/cat/udl/eps/softarch/demo/steps/ViewCatalogueStepDefs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package cat.udl.eps.softarch.demo.steps; | ||
|
||
import cat.udl.eps.softarch.demo.repository.PetRepository; | ||
import io.cucumber.java.en.When; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.MediaType; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; | ||
|
||
public class ViewCatalogueStepDefs { | ||
|
||
@Autowired | ||
private StepDefs stepDefs; | ||
|
||
@Autowired | ||
private PetRepository petRepository; | ||
|
||
@When("I request the Catalogue") | ||
public void viewCatalogue() throws Exception { | ||
stepDefs.result = stepDefs.mockMvc.perform(get("/pets/search/findByIsAdopted?isAdopted=false") | ||
.accept(MediaType.APPLICATION_JSON)) | ||
.andDo(print()); | ||
} | ||
|
||
@When("I request the Catalogue for the specific shelter {long}") | ||
public void viewShelterCatalogue(Long shelter) throws Exception { | ||
stepDefs.result = stepDefs.mockMvc.perform(get("/pets/search/findByShelter?Shelter={shelter}", shelter) | ||
.accept(MediaType.APPLICATION_JSON)) | ||
.andDo(print()); | ||
} | ||
|
||
@When("I request the Catalogue with breed {string}") | ||
public void viewCataloguewithBreed(String breed) throws Exception{ | ||
stepDefs.result = stepDefs.mockMvc.perform(get("/pets/search/findByBreed?breed={breed}", breed) | ||
.accept(MediaType.APPLICATION_JSON)) | ||
.andDo(print()); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Created by globox97 at 11/03/2024 | ||
Feature: View Pets Catalogue | ||
In order to choose a pet to adopt from those available | ||
As a User | ||
I want to view the pet catalogue | ||
|
||
|
||
Scenario: View Pets Catalogue without being logged in | ||
Given I'm not logged in | ||
When I request the Catalogue | ||
Then The response code is 200 | ||
|
||
Scenario: View Pets Catalogue for a specific type of pet without being logged in | ||
Given I'm not logged in | ||
When I request the Catalogue with breed "cat" | ||
Then The response code is 200 | ||
|
||
Scenario: View Pets Catalogue as a Client | ||
Given I login as "client" with password "password" | ||
When I request the Catalogue | ||
Then The response code is 200 | ||
|
||
#Scenario: View Pets Catalogue as a Shelter Volunteer | ||
#Given There is a registered shelter volunteer with username "volunteer" and password "password" and email "[email protected]" | ||
#Given I login with username "volunteer" and password "password" | ||
#When I request the Catalogue for the specific shelter "shelter" | ||
#Then I'm shown the Catalogue from the shelter I work in | ||
#And The response code is 200 |