flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mih...@apache.org
Subject git commit: [flex-sdk] [refs/heads/develop] - FLEX-33058 Testing the behaviour of sealed class instances in ObjectUtil.compare().
Date Tue, 16 Feb 2016 11:52:20 GMT
Repository: flex-sdk
Updated Branches:
  refs/heads/develop 5eaa1d00e -> ca0db33d8


FLEX-33058
Testing the behaviour of sealed class instances in ObjectUtil.compare().


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/ca0db33d
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/ca0db33d
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/ca0db33d

Branch: refs/heads/develop
Commit: ca0db33d8fcebdb800c67cc715cacc2cced39ea6
Parents: 5eaa1d0
Author: Mihai Chira <mihaic@apache.org>
Authored: Tue Feb 16 12:49:49 2016 +0100
Committer: Mihai Chira <mihaic@apache.org>
Committed: Tue Feb 16 12:49:49 2016 +0100

----------------------------------------------------------------------
 .../tests/mx/utils/ObjectUtil_Compare_Tests.as  | 48 ++++++++++++++++++++
 1 file changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/ca0db33d/frameworks/projects/framework/tests/mx/utils/ObjectUtil_Compare_Tests.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/tests/mx/utils/ObjectUtil_Compare_Tests.as b/frameworks/projects/framework/tests/mx/utils/ObjectUtil_Compare_Tests.as
index 5c33d9c..03d7d76 100644
--- a/frameworks/projects/framework/tests/mx/utils/ObjectUtil_Compare_Tests.as
+++ b/frameworks/projects/framework/tests/mx/utils/ObjectUtil_Compare_Tests.as
@@ -83,6 +83,34 @@ package mx.utils {
         }
 
         [Test]
+        public function test_sealed_class_instance_larger_than_anonymous_object_with_same_properties_and_same_values():void
+        {
+            //given
+            var objectA:PersonVO = new PersonVO("John", 23);
+            var objectB:Object = {name:"John", age:23};
+
+            //when
+            var compareResult:int = ObjectUtil.compare(objectA, objectB);
+
+            //then
+            assertEquals(A_LARGER_THAN_B, compareResult);
+        }
+
+        [Test]
+        public function test_sealed_class_instance_larger_than_dynamic_class_instance_with_same_properties_and_same_values():void
+        {
+            //given
+            var objectA:PersonVO = new PersonVO("John", 23);
+            var objectB:DynamicPersonVO = new DynamicPersonVO("John", 23);
+
+            //when
+            var compareResult:int = ObjectUtil.compare(objectA, objectB);
+
+            //then
+            assertEquals(A_LARGER_THAN_B, compareResult);
+        }
+
+        [Test]
         public function test_null_and_undefined_are_seen_equal():void
         {
             //given
@@ -111,3 +139,23 @@ package mx.utils {
         }
     }
 }
+
+class PersonVO
+{
+    public var name:String;
+    public var age:uint;
+
+    public function PersonVO(name:String, age:uint)
+    {
+        this.name = name;
+        this.age = age;
+    }
+}
+
+dynamic class DynamicPersonVO extends PersonVO
+{
+    public function DynamicPersonVO(name:String, age:uint)
+    {
+        super(name, age);
+    }
+}
\ No newline at end of file


Mime
View raw message