You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2021/10/01 06:05:47 UTC

[isis-app-demo] 01/02: adds firstName as parameter to PetOwner#updateName

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/isis-app-demo.git

commit 0ccb1eb4d578113629fd92bf43a2058f6366e41f
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Oct 1 07:04:15 2021 +0100

    adds firstName as parameter to PetOwner#updateName
---
 .../java/petclinic/modules/pets/dom/petowner/PetOwner_Test.java     | 2 +-
 .../petclinic/modules/pets/integtests/tests/PetOwner_IntegTest.java | 4 ++--
 .../src/main/java/petclinic/modules/pets/dom/petowner/PetOwner.java | 6 ++++--
 .../java/petclinic/webapp/integtests/smoke/Smoke_IntegTest.java     | 4 ++--
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/module-pets-tests/src/test/java/petclinic/modules/pets/dom/petowner/PetOwner_Test.java b/module-pets-tests/src/test/java/petclinic/modules/pets/dom/petowner/PetOwner_Test.java
index 5cc3830..a153ab0 100644
--- a/module-pets-tests/src/test/java/petclinic/modules/pets/dom/petowner/PetOwner_Test.java
+++ b/module-pets-tests/src/test/java/petclinic/modules/pets/dom/petowner/PetOwner_Test.java
@@ -41,7 +41,7 @@ class PetOwner_Test {
             assertThat(object.getLastName()).isEqualTo("Foo");
 
             // when
-            object.updateName("Bar");
+            object.updateName("Bar", null);
 
             // then
             assertThat(object.getLastName()).isEqualTo("Bar");
diff --git a/module-pets-tests/src/test/java/petclinic/modules/pets/integtests/tests/PetOwner_IntegTest.java b/module-pets-tests/src/test/java/petclinic/modules/pets/integtests/tests/PetOwner_IntegTest.java
index ca51bb1..34135be 100644
--- a/module-pets-tests/src/test/java/petclinic/modules/pets/integtests/tests/PetOwner_IntegTest.java
+++ b/module-pets-tests/src/test/java/petclinic/modules/pets/integtests/tests/PetOwner_IntegTest.java
@@ -60,7 +60,7 @@ public class PetOwner_IntegTest extends PetsModuleIntegTestAbstract {
         public void can_be_updated_directly() {
 
             // when
-            wrap(petOwner).updateName("new name");
+            wrap(petOwner).updateName("new name", null);
             transactionService.flushTransaction();
 
             // then
@@ -74,7 +74,7 @@ public class PetOwner_IntegTest extends PetsModuleIntegTestAbstract {
             InvalidException cause = assertThrows(InvalidException.class, ()->{
 
                 // when
-                wrap(petOwner).updateName("new name!");
+                wrap(petOwner).updateName("new name!", null);
             });
 
             // then
diff --git a/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwner.java b/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwner.java
index 41d9a5e..e9f7aa8 100644
--- a/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwner.java
+++ b/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwner.java
@@ -125,8 +125,10 @@ public class PetOwner implements Comparable<PetOwner> {
     @Action(semantics = IDEMPOTENT, commandPublishing = Publishing.ENABLED, executionPublishing = Publishing.ENABLED)
     @ActionLayout(associateWith = "lastName", promptStyle = PromptStyle.INLINE)
     public PetOwner updateName(
-            @LastName final String name) {
-        setLastName(name);
+            @LastName final String lastName,
+            @FirstName String firstName) {
+        setLastName(lastName);
+        setFirstName(firstName);
         return this;
     }
     public String default0UpdateName() {
diff --git a/webapp-tests/src/test/java/petclinic/webapp/integtests/smoke/Smoke_IntegTest.java b/webapp-tests/src/test/java/petclinic/webapp/integtests/smoke/Smoke_IntegTest.java
index 8af6b77..4876a84 100644
--- a/webapp-tests/src/test/java/petclinic/webapp/integtests/smoke/Smoke_IntegTest.java
+++ b/webapp-tests/src/test/java/petclinic/webapp/integtests/smoke/Smoke_IntegTest.java
@@ -54,7 +54,7 @@ class Smoke_IntegTest extends WebAppIntegTestAbstract {
 
 
         // when
-        wrap(fred).updateName("Freddy");
+        wrap(fred).updateName("Freddy", null);
         transactionService.flushTransaction();
 
         // then
@@ -71,7 +71,7 @@ class Smoke_IntegTest extends WebAppIntegTestAbstract {
 
         // when
         Assertions.assertThrows(InvalidException.class, () -> {
-            wrap(fred).updateName("New name !!!");
+            wrap(fred).updateName("New name !!!", null);
             transactionService.flushTransaction();
         }, "Exclamation mark is not allowed");