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/02 06:40:26 UTC
[isis-app-demo] 05/05: fixes integ tests
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to tag tags/03-07-derived-PetOwner-name
in repository https://gitbox.apache.org/repos/asf/isis-app-demo.git
commit 35c80e76bd06b199e3e406200c09fce7e26834d2
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Oct 2 07:39:19 2021 +0100
fixes integ tests
---
.../pets/integtests/tests/PetOwner_IntegTest.java | 32 +++++++++++++++++-----
.../webapp/integtests/smoke/Smoke_IntegTest.java | 2 +-
2 files changed, 26 insertions(+), 8 deletions(-)
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 34135be..e3a114b 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
@@ -9,6 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.isis.applib.services.wrapper.DisabledException;
+import org.apache.isis.applib.services.wrapper.HiddenException;
import org.apache.isis.applib.services.wrapper.InvalidException;
import petclinic.modules.pets.dom.petowner.PetOwner;
@@ -33,23 +34,39 @@ public class PetOwner_IntegTest extends PetsModuleIntegTestAbstract {
@Test
public void accessible() {
// when
- final String name = wrap(petOwner).getLastName();
+ final String name = wrap(petOwner).getName();
// then
assertThat(name).isEqualTo(petOwner.getLastName());
}
+ }
- @Test
- public void not_editable() {
+ @Nested
+ public static class lastName extends PetOwner_IntegTest {
+ @Test
+ public void not_accessible() {
// expect
- assertThrows(DisabledException.class, ()->{
+ assertThrows(HiddenException.class, ()->{
// when
- wrap(petOwner).setLastName("new name");
+ wrap(petOwner).getLastName();
});
}
+ }
+
+ @Nested
+ public static class firstName extends PetOwner_IntegTest {
+ @Test
+ public void not_accessible() {
+ // expect
+ assertThrows(HiddenException.class, ()->{
+
+ // when
+ wrap(petOwner).getFirstName();
+ });
+ }
}
@Nested
@@ -60,11 +77,12 @@ public class PetOwner_IntegTest extends PetsModuleIntegTestAbstract {
public void can_be_updated_directly() {
// when
- wrap(petOwner).updateName("new name", null);
+ wrap(petOwner).updateName("McAdam", "Adam");
transactionService.flushTransaction();
// then
- assertThat(wrap(petOwner).getLastName()).isEqualTo("new name");
+ assertThat(petOwner.getLastName()).isEqualTo("McAdam");
+ assertThat(petOwner.getFirstName()).isEqualTo("Adam");
}
@Test
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 4e47cde..1bc39d4 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
@@ -58,7 +58,7 @@ class Smoke_IntegTest extends WebAppIntegTestAbstract {
transactionService.flushTransaction();
// then
- assertThat(wrap(fred).getLastName()).isEqualTo("Freddy");
+ assertThat(wrap(fred).getName()).isEqualTo("Freddy");
// when