[roleInheritance] Use hasSize() in asserting instead of comparing with size()
authorCarlos Aristu <carlos.aristu@openbravo.com>
Thu, 01 Oct 2015 17:27:08 +0200
changeset 27790 74ee8fbfd426
parent 27789 8780c766a8c7
child 27791 1df63ea7bcac
[roleInheritance] Use hasSize() in asserting instead of comparing with size()
src-test/src/org/openbravo/test/role/RecalculatePermissionsTest.java
src-test/src/org/openbravo/test/role/RoleInheritanceRestrictionsTest.java
--- a/src-test/src/org/openbravo/test/role/RecalculatePermissionsTest.java	Thu Oct 01 17:12:35 2015 +0200
+++ b/src-test/src/org/openbravo/test/role/RecalculatePermissionsTest.java	Thu Oct 01 17:27:08 2015 +0200
@@ -19,6 +19,7 @@
 package org.openbravo.test.role;
 
 import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasSize;
 import static org.junit.Assert.assertThat;
 
 import org.junit.Test;
@@ -63,8 +64,8 @@
       role = OBDal.getInstance().get(Role.class, roleId);
       template = OBDal.getInstance().get(Role.class, templateId);
 
-      assertThat("There is a new access created with the recalculation", role
-          .getADWindowAccessList().size(), equalTo(1));
+      assertThat("There is a new access created with the recalculation",
+          role.getADWindowAccessList(), hasSize(1));
 
       String[] expected = { "true", "true", templateId };
       String[] result = RoleInheritanceTestUtils.getAccessInfo("WINDOW", role, "Sales Order");
@@ -115,11 +116,11 @@
       role2 = OBDal.getInstance().get(Role.class, role2Id);
       template = OBDal.getInstance().get(Role.class, templateId);
 
-      assertThat("There is a new access created with the recalculation for role1", role1
-          .getADWindowAccessList().size(), equalTo(1));
+      assertThat("There is a new access created with the recalculation for role1",
+          role1.getADWindowAccessList(), hasSize(1));
 
-      assertThat("There is a new access created with the recalculation for role2", role2
-          .getADWindowAccessList().size(), equalTo(1));
+      assertThat("There is a new access created with the recalculation for role2",
+          role2.getADWindowAccessList(), hasSize(1));
 
       String[] expected = { "true", "true", templateId };
       String[] result = RoleInheritanceTestUtils.getAccessInfo("WINDOW", role1, "Sales Order");
--- a/src-test/src/org/openbravo/test/role/RoleInheritanceRestrictionsTest.java	Thu Oct 01 17:12:35 2015 +0200
+++ b/src-test/src/org/openbravo/test/role/RoleInheritanceRestrictionsTest.java	Thu Oct 01 17:27:08 2015 +0200
@@ -19,6 +19,7 @@
 package org.openbravo.test.role;
 
 import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.hasSize;
 import static org.junit.Assert.assertThat;
 
 import org.junit.Test;
@@ -58,8 +59,8 @@
       }
       inherited = OBDal.getInstance().get(Role.class, inheritedId);
       template = OBDal.getInstance().get(Role.class, templateId);
-      assertThat("Inherit From not duplicated in Role Inheritance", inherited
-          .getADRoleInheritanceList().size(), equalTo(1));
+      assertThat("Inherit From not duplicated in Role Inheritance",
+          inherited.getADRoleInheritanceList(), hasSize(1));
 
     } finally {
       // Delete roles
@@ -100,8 +101,8 @@
       }
       template1 = OBDal.getInstance().get(Role.class, template1Id);
       template2 = OBDal.getInstance().get(Role.class, template2Id);
-      assertThat("Template 1 does not have inheritances", template1.getADRoleInheritanceList()
-          .size(), equalTo(0));
+      assertThat("Template 1 does not have inheritances", template1.getADRoleInheritanceList(),
+          hasSize(0));
 
     } finally {
       // Delete roles