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 2017/10/03 11:58:44 UTC

[isis] 01/24: ISIS-1742: fixes compile issues in test classes (Hamcrest matchers) from changes to DomainEvent hierarchy

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

danhaywood pushed a commit to branch dev/2.0.0/ISIS-1742-remove-deprecations
in repository https://gitbox.apache.org/repos/asf/isis.git

commit e1ca6047bc3f13e73904d4134877819f98a87187
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Oct 3 08:40:48 2017 +0100

    ISIS-1742: fixes compile issues in test classes (Hamcrest matchers) from changes to DomainEvent hierarchy
---
 ...ainEventHelperTest_newActionInteractionEvent.java | 20 +++++++++++---------
 ...ntHelperTest_newCollectionDomainEvent_forAdd.java |  9 +++++----
 ...elperTest_newCollectionDomainEvent_forRemove.java |  9 +++++----
 ...ntHelperTest_newPropertyDomainEvent_forClear.java | 15 +++++++++------
 4 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newActionInteractionEvent.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newActionInteractionEvent.java
index 7831447..6397e6e 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newActionInteractionEvent.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newActionInteractionEvent.java
@@ -21,9 +21,11 @@ import org.junit.Test;
 import org.apache.isis.applib.Identifier;
 import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
 
+import static junit.framework.Assert.assertEquals;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.not;
 import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThat;
 
 public class DomainEventHelperTest_newActionInteractionEvent {
@@ -43,11 +45,11 @@ public class DomainEventHelperTest_newActionInteractionEvent {
 
         final ActionDomainEvent<Object> ev = new DomainEventHelper(null).newActionDomainEvent(
                 ActionDomainEvent.Default.class, identifier, sdo, new Object[]{1, "bar"});
-        assertThat(ev.getSource(), is(sdo));
+        assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getArguments(), is(not(nullValue())));
-        assertThat(ev.getArguments().get(0), is(Integer.valueOf(1)));
-        assertThat(ev.getArguments().get(1), is("bar"));
+        assertEquals(ev.getArguments().get(0), Integer.valueOf(1));
+        assertEquals(ev.getArguments().get(1), "bar");
     }
 
     @Test
@@ -57,11 +59,11 @@ public class DomainEventHelperTest_newActionInteractionEvent {
 
         final ActionDomainEvent<Object> ev = new DomainEventHelper(null).newActionDomainEvent(
                 ActionDomainEvent.Default.class, identifier, sdo, new Object[]{1, "bar"});
-        assertThat(ev.getSource(), is(sdo));
+        assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getArguments(), is(not(nullValue())));
-        assertThat(ev.getArguments().get(0), is(Integer.valueOf(1)));
-        assertThat(ev.getArguments().get(1), is("bar"));
+        assertEquals(ev.getArguments().get(0), Integer.valueOf(1));
+        assertEquals(ev.getArguments().get(1), "bar");
     }
 
     @Test
@@ -71,11 +73,11 @@ public class DomainEventHelperTest_newActionInteractionEvent {
         
         final ActionDomainEvent<SomeDomainObject> ev = new DomainEventHelper(null).newActionDomainEvent(
                 SomeDomainObjectFooInvokedDomainEvent.class, identifier, sdo, new Object[]{1, "bar"});
-        assertThat(ev.getSource(), is(sdo));
+        assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getArguments(), is(not(nullValue())));
-        assertThat(ev.getArguments().get(0), is(Integer.valueOf(1)));
-        assertThat(ev.getArguments().get(1), is("bar"));
+        assertEquals(ev.getArguments().get(0), Integer.valueOf(1));
+        assertEquals(ev.getArguments().get(1), "bar");
     }
     
 }
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
index 9fc1030..d589e77 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forAdd.java
@@ -25,6 +25,7 @@ import org.apache.isis.applib.services.eventbus.AbstractDomainEvent;
 import org.apache.isis.applib.services.eventbus.CollectionDomainEvent;
 
 import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThat;
 
 public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
@@ -46,10 +47,10 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
 
         final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
                 CollectionDomainEvent.Default.class, null, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
-        assertThat(ev.getSource(), is(sdo));
+        assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
-        assertThat(ev.getValue(), is(other));
+        assertSame(ev.getValue(), other);
     }
 
     @Test
@@ -60,10 +61,10 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forAdd {
 
         final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
                 CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.ADD_TO, other);
-        assertThat(ev.getSource(), is(sdo));
+        assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.ADD_TO));
-        assertThat(ev.getValue(), is(other));
+        assertSame(ev.getValue(), other);
     }
 
     @Test
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
index 2a67610..5a8cfb8 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newCollectionDomainEvent_forRemove.java
@@ -25,6 +25,7 @@ import org.apache.isis.applib.services.eventbus.AbstractDomainEvent;
 import org.apache.isis.applib.services.eventbus.CollectionDomainEvent;
 
 import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThat;
 
 public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
@@ -46,10 +47,10 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
 
         final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
                 CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
-        assertThat(ev.getSource(), is(sdo));
+        assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
-        assertThat(ev.getValue(), is(other));
+        assertSame(ev.getValue(), other);
     }
 
     @Test
@@ -60,10 +61,10 @@ public class DomainEventHelperTest_newCollectionDomainEvent_forRemove {
 
         final CollectionDomainEvent<Object, Object> ev = new DomainEventHelper(null).newCollectionDomainEvent(
                 CollectionDomainEvent.Default.class, AbstractDomainEvent.Phase.EXECUTED, identifier, sdo, CollectionDomainEvent.Of.REMOVE_FROM, other);
-        assertThat(ev.getSource(), is(sdo));
+        assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOf(), is(CollectionDomainEvent.Of.REMOVE_FROM));
-        assertThat(ev.getValue(), is(other));
+        assertSame(ev.getValue(), other);
     }
 
     @Test
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forClear.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forClear.java
index c720e1c..46480bc 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forClear.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/DomainEventHelperTest_newPropertyDomainEvent_forClear.java
@@ -18,11 +18,14 @@ package org.apache.isis.core.metamodel.facets;
 
 import org.joda.time.LocalDate;
 import org.junit.Test;
+
 import org.apache.isis.applib.Identifier;
 import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
 
+import static junit.framework.Assert.assertEquals;
 import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThat;
 
 public class DomainEventHelperTest_newPropertyDomainEvent_forClear {
@@ -42,10 +45,10 @@ public class DomainEventHelperTest_newPropertyDomainEvent_forClear {
         
         final PropertyDomainEvent<Object, Object> ev =
                 new DomainEventHelper(null).newPropertyDomainEvent(PropertyDomainEvent.Default.class, identifier, sdo, oldValue, newValue);
-        assertThat(ev.getSource(), is(sdo));
+        assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
-        assertThat(ev.getOldValue(), is(oldValue));
-        assertThat(ev.getNewValue(), is(newValue));
+        assertEquals(ev.getOldValue(), oldValue);
+        assertNull(ev.getNewValue());
     }
 
 
@@ -59,10 +62,10 @@ public class DomainEventHelperTest_newPropertyDomainEvent_forClear {
         
         final PropertyDomainEvent<SomeDomainObject, LocalDate> ev =
                 new DomainEventHelper(null).newPropertyDomainEvent(SomeDatePropertyChangedDomainEvent.class, identifier, sdo, oldValue, newValue);
-        assertThat(ev.getSource(), is(sdo));
+        assertSame(ev.getSource(), sdo);
         assertThat(ev.getIdentifier(), is(identifier));
         assertThat(ev.getOldValue(), is(oldValue));
-        assertThat(ev.getNewValue(), is(nullValue()));
+        assertNull(ev.getNewValue());
     }
     
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.