You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2024/05/26 23:15:22 UTC

(causeway-app-petclinic) 17/17: adds sad case (cannot book visit in the past) as integ test

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/causeway-app-petclinic.git

commit d0af56d0b18b1a843e79a474c78bc07f1c62bfaf
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sun May 26 23:15:53 2024 +0100

    adds sad case (cannot book visit in the past) as integ test
---
 .../integtests/PetOwner_bookVisit_IntegTest.java      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/module-visit/src/test/java/domainapp/modules/visit/integtests/PetOwner_bookVisit_IntegTest.java b/module-visit/src/test/java/domainapp/modules/visit/integtests/PetOwner_bookVisit_IntegTest.java
index 727cd34..94cf5c3 100644
--- a/module-visit/src/test/java/domainapp/modules/visit/integtests/PetOwner_bookVisit_IntegTest.java
+++ b/module-visit/src/test/java/domainapp/modules/visit/integtests/PetOwner_bookVisit_IntegTest.java
@@ -60,6 +60,25 @@ public class PetOwner_bookVisit_IntegTest extends VisitModuleIntegTestAbstract {
         assertThat(visit.getVisitAt()).isEqualTo(visitAt);
     }
 
+    @Test
+    public void cannot_book_in_the_past() {
+
+        // given
+        PetOwner somePetOwner = fakeDataService.enums()
+                .anyOf(PetOwner_persona.class)
+                .findUsing(serviceRegistry);
+        Pet somePet = fakeDataService.collections()
+                .anyOf(somePetOwner.getPets());
+
+        // when, then
+        LocalDateTime visitAt = clockService.getClock().nowAsLocalDateTime();
+
+        assertThatThrownBy(() ->
+                wrapMixin(PetOwner_bookVisit.class, somePetOwner).act(somePet, visitAt)
+        )
+                .isInstanceOf(InvalidException.class)
+                .hasMessage("Must book in the future");
+    }
 
 
     @Inject FakeDataService fakeDataService;