rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlu...@apache.org
Subject svn commit: r1157985 - in /incubator/rave/trunk/rave-portal/src: main/java/org/apache/rave/portal/model/ test/java/org/apache/rave/portal/service/
Date Mon, 15 Aug 2011 20:25:56 GMT
Author: carlucci
Date: Mon Aug 15 20:25:56 2011
New Revision: 1157985

URL: http://svn.apache.org/viewvc?rev=1157985&view=rev
Log:
model updates:
- all entity classes should be implementing the Serializable interface
- all entity classes should be overriding equals and hashcode methods
- implemented toString methods where needed

Modified:
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Page.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/PageLayout.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Region.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidgetPreference.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/User.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/service/PageServiceTest.java

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Page.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Page.java?rev=1157985&r1=1157984&r2=1157985&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Page.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Page.java
Mon Aug 15 20:25:56 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.rave.portal.model;
 
+import java.io.Serializable;
 import org.apache.rave.persistence.BasicEntity;
 import org.codehaus.jackson.annotate.JsonManagedReference;
 
@@ -35,7 +36,9 @@ import java.util.List;
         @NamedQuery(name = "Page.getByUserId", query="SELECT p FROM Page p WHERE p.owner.id
= :userId")
 })
 @Access(AccessType.FIELD)
-public class Page implements BasicEntity {
+public class Page implements BasicEntity, Serializable {
+    private static final long serialVersionUID = 1L;
+    
     @Id @Column(name="id")
     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "pageIdSeq")
     private Long id;
@@ -71,10 +74,12 @@ public class Page implements BasicEntity
      *
      * @return id The ID of persisted object; null if not persisted
      */
+    @Override
     public Long getId() {
         return id;
     }
 
+    @Override
     public void setId(Long id) {
         this.id = id;
     }
@@ -145,4 +150,31 @@ public class Page implements BasicEntity
     public void setRegions(List<Region> regions) {
         this.regions = regions;
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Page other = (Page) obj;
+        if (this.id != other.id && (this.id == null || !this.id.equals(other.id)))
{
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 89 * hash + (this.id != null ? this.id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public String toString() {
+        return "Page{" + "id=" + id + ", name=" + name + ", owner=" + owner + ", renderSequence="
+ renderSequence + ", pageLayout=" + pageLayout + ", regions=" + regions + '}';
+    }    
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/PageLayout.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/PageLayout.java?rev=1157985&r1=1157984&r2=1157985&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/PageLayout.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/PageLayout.java
Mon Aug 15 20:25:56 2011
@@ -19,6 +19,7 @@
 
 package org.apache.rave.portal.model;
 
+import java.io.Serializable;
 import org.apache.rave.persistence.BasicEntity;
 
 import javax.persistence.*;
@@ -33,7 +34,9 @@ import javax.persistence.*;
     @NamedQuery(name="PageLayout.getByLayoutCode", query = "select pl from PageLayout pl
where pl.code = :code")
 })
 
-public class PageLayout implements BasicEntity {
+public class PageLayout implements BasicEntity, Serializable {
+    private static final long serialVersionUID = 1L;
+    
     @Id @Column(name="id")
     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "pageLayoutIdSeq")
     private Long id;
@@ -49,10 +52,12 @@ public class PageLayout implements Basic
      *
      * @return id The ID of persisted object; null if not persisted
      */
+    @Override
     public Long getId() {
         return id;
     }
 
+    @Override
     public void setId(Long id) {
         this.id = id;
     }
@@ -82,4 +87,31 @@ public class PageLayout implements Basic
     public void setNumberOfRegions(Long numberOfRegions) {
         this.numberOfRegions = numberOfRegions;
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final PageLayout other = (PageLayout) obj;
+        if (this.id != other.id && (this.id == null || !this.id.equals(other.id)))
{
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 5;
+        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public String toString() {
+        return "PageLayout{" + "id=" + id + ", code=" + code + ", numberOfRegions=" + numberOfRegions
+ '}';
+    }
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Region.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Region.java?rev=1157985&r1=1157984&r2=1157985&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Region.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Region.java
Mon Aug 15 20:25:56 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.rave.portal.model;
 
+import java.io.Serializable;
 import org.apache.rave.persistence.BasicEntity;
 import org.codehaus.jackson.annotate.JsonBackReference;
 import org.codehaus.jackson.annotate.JsonManagedReference;
@@ -32,7 +33,9 @@ import java.util.List;
 @Table(name="region")
 @SequenceGenerator(name="regionIdSeq", sequenceName = "region_id_seq")
 @Access(AccessType.FIELD)
-public class Region implements BasicEntity {
+public class Region implements BasicEntity, Serializable {
+    private static final long serialVersionUID = 1L;
+     
     @Id @Column(name="id")
     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "regionIdSeq")
     private Long id;
@@ -63,10 +66,12 @@ public class Region implements BasicEnti
      *
      * @return id The ID of persisted object; null if not persisted
      */
+    @Override
     public Long getId() {
         return id;
     }
 
+    @Override
     public void setId(Long id) {
         this.id = id;
     }
@@ -98,4 +103,31 @@ public class Region implements BasicEnti
     public void setRegionWidgets(List<RegionWidget> regionWidgets) {
         this.regionWidgets = regionWidgets;
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Region other = (Region) obj;
+        if (this.id != other.id && (this.id == null || !this.id.equals(other.id)))
{
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 3;
+        hash = 67 * hash + (this.id != null ? this.id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public String toString() {
+        return "Region{" + "id=" + id + ", page=" + page + ", regionWidgets=" + regionWidgets
+ '}';
+    }
 }

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java?rev=1157985&r1=1157984&r2=1157985&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidget.java
Mon Aug 15 20:25:56 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.rave.portal.model;
 
+import java.io.Serializable;
 import org.apache.rave.persistence.BasicEntity;
 import org.codehaus.jackson.annotate.JsonBackReference;
 
@@ -30,7 +31,9 @@ import java.util.List;
 @Entity
 @Table(name = "region_widget")
 @SequenceGenerator(name = "regionWidgetIdSeq", sequenceName = "region_widget_id_seq")
-public class RegionWidget implements BasicEntity {
+public class RegionWidget implements BasicEntity, Serializable {
+    private static final long serialVersionUID = 1L;
+    
     @Id
     @Column(name = "id")
     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "regionWidgetIdSeq")
@@ -67,8 +70,10 @@ public class RegionWidget implements Bas
         this.id = id;
     }
 
-    public RegionWidget(long id, int renderOrder) {
+    public RegionWidget(Long id, Widget widget, Region region, int renderOrder) {
         this.id = id;
+        this.widget = widget;
+        this.region = region;
         this.renderOrder = renderOrder;
     }
 
@@ -83,10 +88,12 @@ public class RegionWidget implements Bas
      *
      * @return id The ID of persisted object; null if not persisted
      */
+    @Override
     public Long getId() {
         return id;
     }
 
+    @Override
     public void setId(Long id) {
         this.id = id;
     }
@@ -173,4 +180,31 @@ public class RegionWidget implements Bas
     public void setPreferences(List<RegionWidgetPreference> preferences) {
         this.preferences = preferences;
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final RegionWidget other = (RegionWidget) obj;
+        if (this.id != other.id && (this.id == null || !this.id.equals(other.id)))
{
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 5;
+        hash = 23 * hash + (this.id != null ? this.id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public String toString() {
+        return "RegionWidget{" + "id=" + id + ", widget=" + widget + ", region=" + region
+ ", renderPosition=" + renderPosition + ", renderOrder=" + renderOrder + ", collapsed=" +
collapsed + ", preferences=" + preferences + '}';
+    }
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidgetPreference.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidgetPreference.java?rev=1157985&r1=1157984&r2=1157985&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidgetPreference.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/RegionWidgetPreference.java
Mon Aug 15 20:25:56 2011
@@ -19,6 +19,7 @@
 
 package org.apache.rave.portal.model;
 
+import java.io.Serializable;
 import org.apache.rave.persistence.BasicEntity;
 
 import javax.persistence.*;
@@ -31,7 +32,9 @@ import javax.xml.bind.annotation.XmlRoot
 @Table(name = "region_widget_preference")
 @SequenceGenerator(name = "regionWidgetPrefIdSeq", sequenceName = "region_widget_pref_id_seq")
 @XmlRootElement
-public class RegionWidgetPreference implements BasicEntity {
+public class RegionWidgetPreference implements BasicEntity, Serializable {
+    private static final long serialVersionUID = 1L;
+    
     @Id
     @Column(name = "id")
     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "regionWidgetPrefIdSeq")
@@ -64,10 +67,12 @@ public class RegionWidgetPreference impl
      *
      * @return id The ID of persisted object; null if not persisted
      */
+    @Override
     public Long getId() {
         return id;
     }
 
+    @Override
     public void setId(Long id) {
         this.id = id;
     }
@@ -111,6 +116,28 @@ public class RegionWidgetPreference impl
     }
 
     @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final RegionWidgetPreference other = (RegionWidgetPreference) obj;
+        if (this.id != other.id && (this.id == null || !this.id.equals(other.id)))
{
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
     public String toString() {
         return "RegionWidgetPreference{" +
                 "id=" + id +

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/User.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/User.java?rev=1157985&r1=1157984&r2=1157985&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/User.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/User.java
Mon Aug 15 20:25:56 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.rave.portal.model;
 
+import java.io.Serializable;
 import org.apache.rave.persistence.BasicEntity;
 import org.springframework.security.core.GrantedAuthority;
 import org.springframework.security.core.userdetails.UserDetails;
@@ -36,7 +37,9 @@ import java.util.Collection;
 @NamedQueries({
     @NamedQuery(name="User.getByUsername", query = "select u from User u where u.username
= :username")
 })
-public class User implements UserDetails, BasicEntity {
+public class User implements UserDetails, BasicEntity, Serializable {
+    private static final long serialVersionUID = 1L;
+    
     @Id @Column(name = "user_id")
     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "userIdSeq")
     private Long id;
@@ -56,13 +59,13 @@ public class User implements UserDetails
     @Basic @Column(name = "enabled")
     private boolean enabled;
 
-	 @Basic @Column(name="email")
-	 private String email;
+    @Basic @Column(name="email")
+    private String email;
 
-	 @Basic @Column(name="openid")
-	 private String openId;
+    @Basic @Column(name="openid")
+    private String openId;
 
-	 private String confirmPassword;
+    private String confirmPassword;
 
     public User() {
     }
@@ -81,10 +84,12 @@ public class User implements UserDetails
      *
      * @return The unique identifier for this user.
      */
+    @Override
     public Long getId() {
         return id;
     }
 
+    @Override
     public void setId(Long id) {
         this.id = id;
     }
@@ -159,37 +164,63 @@ public class User implements UserDetails
         this.enabled = enabled;
     }
 
-	 //The following properties are specific to the user profile.
-	 public String getEmail() {
-		  return email;
-	 }
-	 
-	 public void setEmail(String email) {
-		  this.email=email;
-	 }
-
-	 public String getOpenId() {
-		  return openId;
-	 }
-	 
-	 public void setOpenId(String openId){
-		  this.openId=openId;
-	 }
-	 
-	 public String getConfirmPassword() {
-		  //confirmPassword is not stored persistently, so if the value is not set,
-		  //return the password instead. This will need to be as secure as the password
-		  //field itself. 
-		  if(confirmPassword!=null && confirmPassword.length()>0) {
-				return confirmPassword;
-		  }
-		  else {
-				return password;
-		  }
-	 }
-
-	 public void setConfirmPassword(String confirmPassword) {
-		  this.confirmPassword=confirmPassword;
-	 }
+    //The following properties are specific to the user profile.
+    public String getEmail() {
+          return email;
+    }
+
+    public void setEmail(String email) {
+          this.email=email;
+    }
+
+    public String getOpenId() {
+          return openId;
+    }
+
+    public void setOpenId(String openId){
+          this.openId=openId;
+    }
+
+    public String getConfirmPassword() {
+          //confirmPassword is not stored persistently, so if the value is not set,
+          //return the password instead. This will need to be as secure as the password
+          //field itself. 
+          if(confirmPassword!=null && confirmPassword.length()>0) {
+                        return confirmPassword;
+          }
+          else {
+                        return password;
+          }
+    }
 
+    public void setConfirmPassword(String confirmPassword) {
+          this.confirmPassword=confirmPassword;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final User other = (User) obj;
+        if (this.id != other.id && (this.id == null || !this.id.equals(other.id)))
{
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 67 * hash + (this.id != null ? this.id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public String toString() {
+        return "User{" + "id=" + id + ", username=" + username + ", password=" + password
+ ", expired=" + expired + ", locked=" + locked + ", enabled=" + enabled + ", email=" + email
+ ", openId=" + openId + ", confirmPassword=" + confirmPassword + '}';
+    }
 }

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java?rev=1157985&r1=1157984&r2=1157985&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/portal/model/Widget.java
Mon Aug 15 20:25:56 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.rave.portal.model;
 
+import java.io.Serializable;
 import org.apache.rave.persistence.BasicEntity;
 
 import javax.persistence.*;
@@ -31,7 +32,9 @@ import javax.persistence.*;
 @NamedQueries({
         @NamedQuery(name = "Widget.getAll", query = "SELECT w from Widget w")
 })
-public class Widget implements BasicEntity {
+public class Widget implements BasicEntity, Serializable {
+    private static final long serialVersionUID = 1L;
+    
     @Id @Column(name="id")
     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "widgetIdSeq")
     private Long id;
@@ -75,10 +78,12 @@ public class Widget implements BasicEnti
      *
      * @return id The ID of persisted object; null if not persisted
      */
+    @Override
     public Long getId() {
         return id;
     }
 
+    @Override
     public void setId(Long id) {
         this.id = id;
     }
@@ -148,4 +153,31 @@ public class Widget implements BasicEnti
     public void setUrl(String url) {
         this.url = url;
     }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final Widget other = (Widget) obj;
+        if (this.id != other.id && (this.id == null || !this.id.equals(other.id)))
{
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0);
+        return hash;
+    }
+
+    @Override
+    public String toString() {
+        return "Widget{" + "id=" + id + ", title=" + title + ", url=" + url + ", thumbnailUrl="
+ thumbnailUrl + ", screenshotUrl=" + screenshotUrl + ", type=" + type + ", author=" + author
+ ", description=" + description + '}';
+    }
 }
\ No newline at end of file

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/service/PageServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/service/PageServiceTest.java?rev=1157985&r1=1157984&r2=1157985&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/service/PageServiceTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/service/PageServiceTest.java
Mon Aug 15 20:25:56 2011
@@ -52,6 +52,7 @@ public class PageServiceTest {
     private static final long FROM_REGION_ID = 2L;
     private Region targetRegion;
     private Region originalRegion;
+    private Widget widget;
 
     @Before
     public void setup() {
@@ -62,17 +63,21 @@ public class PageServiceTest {
         regionWidgetRepository = createNiceMock(RegionWidgetRepository.class);
         pageService = new DefaultPageService(pageRepository, regionRepository, widgetRepository,
regionWidgetRepository);
 
+        widget = new Widget(1L, "http://dummy.apache.org/widgets/widget.xml");
+        
         targetRegion = new Region();
+        targetRegion.setId(2L);
         targetRegion.setRegionWidgets(new ArrayList<RegionWidget>());
-        targetRegion.getRegionWidgets().add(new RegionWidget(1L, 0));
-        targetRegion.getRegionWidgets().add(new RegionWidget(2L, 1));
-        targetRegion.getRegionWidgets().add(new RegionWidget(3L, 2));
+        targetRegion.getRegionWidgets().add(new RegionWidget(1L, widget, targetRegion, 0));
+        targetRegion.getRegionWidgets().add(new RegionWidget(2L, widget, targetRegion, 1));
+        targetRegion.getRegionWidgets().add(new RegionWidget(3L, widget, targetRegion, 2));
 
         originalRegion = new Region();
+        originalRegion.setId(1L);
         originalRegion.setRegionWidgets(new ArrayList<RegionWidget>());
-        originalRegion.getRegionWidgets().add(new RegionWidget(4L, 0));
-        originalRegion.getRegionWidgets().add(new RegionWidget(5L, 1));
-        originalRegion.getRegionWidgets().add(new RegionWidget(6L, 2));
+        originalRegion.getRegionWidgets().add(new RegionWidget(4L, widget, targetRegion,
0));
+        originalRegion.getRegionWidgets().add(new RegionWidget(5L, widget, targetRegion,
1));
+        originalRegion.getRegionWidgets().add(new RegionWidget(6L, widget, targetRegion,
2));
     }
 
     @Test
@@ -264,13 +269,13 @@ public class PageServiceTest {
     }
 
     private void verifyPositions(int newPosition, RegionWidget widget, boolean sameRegion)
{
-        assertThat(widget.getRenderOrder(), is(equalTo(newPosition)));
+        assertThat(widget.getRenderOrder(), is(equalTo(newPosition)));        
+        assertOrder(originalRegion);
+        assertThat(originalRegion.getRegionWidgets().contains(widget), is(sameRegion));
         if (!sameRegion) {
             assertOrder(targetRegion);
             assertThat(targetRegion.getRegionWidgets().contains(widget), is(true));
         }
-        assertOrder(originalRegion);
-        assertThat(originalRegion.getRegionWidgets().contains(widget), is(sameRegion));
     }
 
     private void createMoveBetweenRegionsExpectations() {



Mime
View raw message