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 2017/05/23 02:14:05 UTC
[22/33] polygene-java git commit: Add some coverage for clearing
associations
Add some coverage for clearing associations
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/ea8b7092
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/ea8b7092
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/ea8b7092
Branch: refs/heads/yeoman-work
Commit: ea8b7092f7b4ac60d77f64197c0dcdd9fcb66bcc
Parents: 7c6bc1b
Author: Paul Merlin <pa...@apache.org>
Authored: Sun May 21 17:40:46 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Sun May 21 17:40:46 2017 +0200
----------------------------------------------------------------------
.../runtime/entity/associations/AssociationTest.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/ea8b7092/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java
index f049c40..1e953ae 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java
@@ -36,6 +36,10 @@ import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.test.EntityTestAssembler;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
+import static org.junit.Assert.assertThat;
+
/**
* Tests for associations
*/
@@ -98,6 +102,12 @@ public class AssociationTest
Assert.assertEquals( niclas.friend().get(), rickard );
Assert.assertEquals( niclas.members().get( 0 ), rickard );
+
+ // Empty associations
+ niclas.friend().set( null );
+ niclas.members().clear();
+ assertThat( niclas.friend().get(), nullValue() );
+ assertThat( niclas.employers().count(), is( 0 ) );
}
finally
{