You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/07/17 16:06:32 UTC

[7/7] zest-qi4j git commit: Testcase for NamedAssociation equals/hashCode

Testcase for NamedAssociation equals/hashCode


Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/a0c74a7b
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/a0c74a7b
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/a0c74a7b

Branch: refs/heads/develop
Commit: a0c74a7ba11b41849badf8dce1ec97240fa6d05a
Parents: 585a3c6
Author: Niclas Hedhman <he...@betfair.com>
Authored: Fri Jul 17 17:06:17 2015 +0300
Committer: Niclas Hedhman <he...@betfair.com>
Committed: Fri Jul 17 17:06:17 2015 +0300

----------------------------------------------------------------------
 ...AbstractValueCompositeSerializationTest.java | 29 +++++++++++---------
 1 file changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/a0c74a7b/core/testsupport/src/main/java/org/qi4j/test/value/AbstractValueCompositeSerializationTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/qi4j/test/value/AbstractValueCompositeSerializationTest.java b/core/testsupport/src/main/java/org/qi4j/test/value/AbstractValueCompositeSerializationTest.java
index c3ed57a..01d2f51 100644
--- a/core/testsupport/src/main/java/org/qi4j/test/value/AbstractValueCompositeSerializationTest.java
+++ b/core/testsupport/src/main/java/org/qi4j/test/value/AbstractValueCompositeSerializationTest.java
@@ -48,8 +48,6 @@ import org.qi4j.api.value.ValueComposite;
 import org.qi4j.api.value.ValueSerialization;
 import org.qi4j.bootstrap.AssemblyException;
 import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.entitystore.memory.MemoryEntityStoreService;
-import org.qi4j.spi.uuid.UuidIdentityGeneratorService;
 import org.qi4j.test.AbstractQi4jTest;
 import org.qi4j.test.EntityTestAssembler;
 
@@ -143,15 +141,9 @@ public abstract class AbstractValueCompositeSerializationTest
         specificColProto.genericList().set( genericList );
         proto.specificCollection().set( specificColBuilder.newInstance() );
 
-        /*
-         ValueBuilder<SpecificValue> specificValue = module.newValueBuilder(SpecificValue.class);
-         specificValue.prototype().item().set("Foo");
-         proto.specificValue().set(specificValue.newInstance());
-         */
-        ValueBuilder<AnotherValue> valueBuilder = module.newValueBuilder( AnotherValue.class );
-        valueBuilder.prototype().val1().set( "Foo" );
-        valueBuilder.prototypeFor( AnotherValueInternalState.class ).val2().set( "Bar" );
-        AnotherValue anotherValue = valueBuilder.newInstance();
+        AnotherValue anotherValue1 = createAnotherValue( "Foo", "Bar" );
+        AnotherValue anotherValue2 = createAnotherValue( "Habba", "ZoutZout" );
+        AnotherValue anotherValue3 = createAnotherValue( "Niclas", "Hedhman" );
 
         // FIXME Some Control Chars are not supported in JSON nor in XML, what should we do about it?
         // Should Zest Core ensure the chars used in strings are supported by the whole stack?
@@ -174,8 +166,9 @@ public abstract class AbstractValueCompositeSerializationTest
         //
         // proto.stringIntMap().get().put( "bar", 67 );
 
-        proto.stringValueMap().get().put( "foo", anotherValue );
-        proto.another().set( anotherValue );
+        proto.stringValueMap().get().put( "foo", anotherValue1 );
+        proto.another().set( anotherValue1 );
+        proto.arrayOfValues().set( new AnotherValue[] { anotherValue1, anotherValue2, anotherValue3 } );
         proto.serializable().set( new SerializableObject() );
         proto.foo().set( module.newValue( FooValue.class ) );
         proto.fooValue().set( module.newValue( FooValue.class ) );
@@ -204,6 +197,14 @@ public abstract class AbstractValueCompositeSerializationTest
         return builder.newInstance();
     }
 
+    private AnotherValue createAnotherValue( String val1, String val2 )
+    {
+        ValueBuilder<AnotherValue> valueBuilder = module.newValueBuilder( AnotherValue.class );
+        valueBuilder.prototype().val1().set( val1 );
+        valueBuilder.prototypeFor( AnotherValueInternalState.class ).val2().set( val2 );
+        return valueBuilder.newInstance();
+    }
+
     private BarEntity buildBarEntity( String cathedral )
     {
         EntityBuilder<BarEntity> barBuilder = module.currentUnitOfWork().newEntityBuilder( BarEntity.class );
@@ -253,6 +254,8 @@ public abstract class AbstractValueCompositeSerializationTest
 
         Property<AnotherValue> another();
 
+        Property<AnotherValue[]> arrayOfValues();
+
         @Optional
         Property<AnotherValue> anotherNull();