polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [09/14] polygene-java git commit: Migrating to JUnit5. Intermediary build where all tests of phase 1 compiles, but not necessarily succeeds.
Date Sun, 15 Apr 2018 05:55:24 GMT
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java
index 9d51f48..172f708 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java
@@ -40,9 +40,11 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.test.EntityTestAssembler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 public class ServiceVisibilityTest
 {
@@ -53,7 +55,7 @@ public class ServiceVisibilityTest
     private Application app;
     private UnitOfWorkFactory uowf;
 
-    @Before
+    @BeforeEach
     public void setup()
         throws Exception
     {
@@ -69,7 +71,7 @@ public class ServiceVisibilityTest
                 { // Layer From
                   { // From Module
                     new FromAssembler(),
-                  },
+                    },
                   { // Beside Module
                     new BesideAssembler()
                   }
@@ -88,7 +90,7 @@ public class ServiceVisibilityTest
         uowf = module.unitOfWorkFactory();
     }
 
-    @After
+    @AfterEach
     public void tearDown()
         throws Exception
     {
@@ -130,11 +132,13 @@ public class ServiceVisibilityTest
         service.besideLayerVisible();
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromServiceWhenAccessingBesideModuleVisibleExpectException()
     {
-        FromService service = module.findService( FromService.class ).get();
-        service.besideModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromService service = module.findService( FromService.class ).get();
+            service.besideModuleVisible();
+        } );
     }
 
     @Test
@@ -144,39 +148,49 @@ public class ServiceVisibilityTest
         service.belowApplicationVisible();
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromServiceWhenAccessingBelowLayerVisibleExpectException()
     {
-        FromService service = module.findService( FromService.class ).get();
-        service.belowLayerVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromService service = module.findService( FromService.class ).get();
+            service.belowLayerVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromServiceWhenAccessingBelowModuleVisibleExpectException()
     {
-        FromService service = module.findService( FromService.class ).get();
-        service.belowModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromService service = module.findService( FromService.class ).get();
+            service.belowModuleVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromServiceWhenAccessingAboveApplicationVisibleExpectException()
     {
-        FromService service = module.findService( FromService.class ).get();
-        service.aboveApplicationVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromService service = module.findService( FromService.class ).get();
+            service.aboveApplicationVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromServiceWhenAccessingAboveLayerVisibleExpectException()
     {
-        FromService service = module.findService( FromService.class ).get();
-        service.aboveLayerVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromService service = module.findService( FromService.class ).get();
+            service.aboveLayerVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromServiceWhenAccessingAboveModuleVisibleExpectException()
     {
-        FromService service = module.findService( FromService.class ).get();
-        service.aboveModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromService service = module.findService( FromService.class ).get();
+            service.aboveModuleVisible();
+        } );
     }
 
     @Test
@@ -185,7 +199,7 @@ public class ServiceVisibilityTest
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
         try
         {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
+            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
             entity.moduleApplicationVisible();
         }
         finally
@@ -203,7 +217,7 @@ public class ServiceVisibilityTest
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
         try
         {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
+            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
             entity.moduleLayerVisible();
         }
         finally
@@ -221,7 +235,7 @@ public class ServiceVisibilityTest
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
         try
         {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
+            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
             entity.moduleModuleVisible();
         }
         finally
@@ -239,7 +253,7 @@ public class ServiceVisibilityTest
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
         try
         {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
+            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
             entity.besideApplicationVisible();
         }
         finally
@@ -257,7 +271,7 @@ public class ServiceVisibilityTest
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
         try
         {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
+            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
             entity.besideLayerVisible();
         }
         finally
@@ -269,22 +283,24 @@ public class ServiceVisibilityTest
         }
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromEntityWhenAccessingBesideModuleVisibleExpectException()
     {
-        UnitOfWork unitOfWork = uowf.newUnitOfWork();
-        try
-        {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
-            entity.besideModuleVisible();
-        }
-        finally
-        {
-            if( unitOfWork.isOpen() )
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            UnitOfWork unitOfWork = uowf.newUnitOfWork();
+            try
             {
-                unitOfWork.discard();
+                FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
+                entity.besideModuleVisible();
             }
-        }
+            finally
+            {
+                if( unitOfWork.isOpen() )
+                {
+                    unitOfWork.discard();
+                }
+            }
+        } );
     }
 
     @Test
@@ -293,7 +309,7 @@ public class ServiceVisibilityTest
         UnitOfWork unitOfWork = uowf.newUnitOfWork();
         try
         {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
+            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
             entity.belowApplicationVisible();
         }
         finally
@@ -305,94 +321,104 @@ public class ServiceVisibilityTest
         }
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromEntityWhenAccessingBelowLayerVisibleExpectException()
     {
-        UnitOfWork unitOfWork = uowf.newUnitOfWork();
-        try
-        {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
-            entity.belowLayerVisible();
-        }
-        finally
-        {
-            if( unitOfWork.isOpen() )
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            UnitOfWork unitOfWork = uowf.newUnitOfWork();
+            try
             {
-                unitOfWork.discard();
+                FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
+                entity.belowLayerVisible();
             }
-        }
+            finally
+            {
+                if( unitOfWork.isOpen() )
+                {
+                    unitOfWork.discard();
+                }
+            }
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromEntityWhenAccessingBelowModuleVisibleExpectException()
     {
-        UnitOfWork unitOfWork = uowf.newUnitOfWork();
-        try
-        {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
-            entity.belowModuleVisible();
-        }
-        finally
-        {
-            if( unitOfWork.isOpen() )
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            UnitOfWork unitOfWork = uowf.newUnitOfWork();
+            try
             {
-                unitOfWork.discard();
+                FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
+                entity.belowModuleVisible();
             }
-        }
+            finally
+            {
+                if( unitOfWork.isOpen() )
+                {
+                    unitOfWork.discard();
+                }
+            }
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromEntityWhenAccessingAboveApplicationVisibleExpectException()
     {
-        UnitOfWork unitOfWork = uowf.newUnitOfWork();
-        try
-        {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
-            entity.aboveApplicationVisible();
-        }
-        finally
-        {
-            if( unitOfWork.isOpen() )
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            UnitOfWork unitOfWork = uowf.newUnitOfWork();
+            try
             {
-                unitOfWork.discard();
+                FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
+                entity.aboveApplicationVisible();
             }
-        }
+            finally
+            {
+                if( unitOfWork.isOpen() )
+                {
+                    unitOfWork.discard();
+                }
+            }
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromEntityWhenAccessingAboveLayerVisibleExpectException()
     {
-        UnitOfWork unitOfWork = uowf.newUnitOfWork();
-        try
-        {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
-            entity.aboveLayerVisible();
-        }
-        finally
-        {
-            if( unitOfWork.isOpen() )
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            UnitOfWork unitOfWork = uowf.newUnitOfWork();
+            try
             {
-                unitOfWork.discard();
+                FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
+                entity.aboveLayerVisible();
             }
-        }
+            finally
+            {
+                if( unitOfWork.isOpen() )
+                {
+                    unitOfWork.discard();
+                }
+            }
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromEntityWhenAccessingAboveModuleVisibleExpectException()
     {
-        UnitOfWork unitOfWork = uowf.newUnitOfWork();
-        try
-        {
-            FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY);
-            entity.aboveModuleVisible();
-        }
-        finally
-        {
-            if( unitOfWork.isOpen() )
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            UnitOfWork unitOfWork = uowf.newUnitOfWork();
+            try
             {
-                unitOfWork.discard();
+                FromEntity entity = unitOfWork.newEntity( FromEntity.class, TEST_IDENTITY );
+                entity.aboveModuleVisible();
             }
-        }
+            finally
+            {
+                if( unitOfWork.isOpen() )
+                {
+                    unitOfWork.discard();
+                }
+            }
+        } );
     }
 
     @Test
@@ -430,11 +456,13 @@ public class ServiceVisibilityTest
         value.besideLayerVisible();
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromValueWhenAccessingBesideModuleVisibleExpectException()
     {
-        FromValue value = module.newValue( FromValue.class );
-        value.besideModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromValue value = module.newValue( FromValue.class );
+            value.besideModuleVisible();
+        } );
     }
 
     @Test
@@ -444,39 +472,49 @@ public class ServiceVisibilityTest
         value.belowApplicationVisible();
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromValueWhenAccessingBelowLayerVisibleExpectException()
     {
-        FromValue value = module.newValue( FromValue.class );
-        value.belowLayerVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromValue value = module.newValue( FromValue.class );
+            value.belowLayerVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromValueWhenAccessingBelowModuleVisibleExpectException()
     {
-        FromValue value = module.newValue( FromValue.class );
-        value.belowModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromValue value = module.newValue( FromValue.class );
+            value.belowModuleVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromValueWhenAccessingAboveApplicationVisibleExpectException()
     {
-        FromValue value = module.newValue( FromValue.class );
-        value.aboveApplicationVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromValue value = module.newValue( FromValue.class );
+            value.aboveApplicationVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromValueWhenAccessingAboveLayerVisibleExpectException()
     {
-        FromValue value = module.newValue( FromValue.class );
-        value.aboveLayerVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromValue value = module.newValue( FromValue.class );
+            value.aboveLayerVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromValueWhenAccessingAboveModuleVisibleExpectException()
     {
-        FromValue value = module.newValue( FromValue.class );
-        value.aboveModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromValue value = module.newValue( FromValue.class );
+            value.aboveModuleVisible();
+        } );
     }
 
     @Test
@@ -514,11 +552,13 @@ public class ServiceVisibilityTest
         transientt.besideLayerVisible();
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromTransientWhenAccessingBesideModuleVisibleExpectException()
     {
-        FromTransient transientt = module.newTransient( FromTransient.class );
-        transientt.besideModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromTransient transientt = module.newTransient( FromTransient.class );
+            transientt.besideModuleVisible();
+        } );
     }
 
     @Test
@@ -528,39 +568,49 @@ public class ServiceVisibilityTest
         transientt.belowApplicationVisible();
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromTransientWhenAccessingBelowLayerVisibleExpectException()
     {
-        FromTransient transientt = module.newTransient( FromTransient.class );
-        transientt.belowLayerVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromTransient transientt = module.newTransient( FromTransient.class );
+            transientt.belowLayerVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromTransientWhenAccessingBelowModuleVisibleExpectException()
     {
-        FromTransient transientt = module.newTransient( FromTransient.class );
-        transientt.belowModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromTransient transientt = module.newTransient( FromTransient.class );
+            transientt.belowModuleVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromTransientWhenAccessingAboveApplicationVisibleExpectException()
     {
-        FromTransient transientt = module.newTransient( FromTransient.class );
-        transientt.aboveApplicationVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromTransient transientt = module.newTransient( FromTransient.class );
+            transientt.aboveApplicationVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromTransientWhenAccessingAboveLayerVisibleExpectException()
     {
-        FromTransient transientt = module.newTransient( FromTransient.class );
-        transientt.aboveLayerVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromTransient transientt = module.newTransient( FromTransient.class );
+            transientt.aboveLayerVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromTransientWhenAccessingAboveModuleVisibleExpectException()
     {
-        FromTransient transientt = module.newTransient( FromTransient.class );
-        transientt.aboveModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromTransient transientt = module.newTransient( FromTransient.class );
+            transientt.aboveModuleVisible();
+        } );
     }
 
     @Test
@@ -598,11 +648,13 @@ public class ServiceVisibilityTest
         object.besideLayerVisible();
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromObjectWhenAccessingBesideModuleVisibleExpectException()
     {
-        FromObject object = module.newObject( FromObject.class );
-        object.besideModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromObject object = module.newObject( FromObject.class );
+            object.besideModuleVisible();
+        } );
     }
 
     @Test
@@ -612,39 +664,49 @@ public class ServiceVisibilityTest
         object.belowApplicationVisible();
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromObjectWhenAccessingBelowLayerVisibleExpectException()
     {
-        FromObject object = module.newObject( FromObject.class );
-        object.belowLayerVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromObject object = module.newObject( FromObject.class );
+            object.belowLayerVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromObjectWhenAccessingBelowModuleVisibleExpectException()
     {
-        FromObject object = module.newObject( FromObject.class );
-        object.belowModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromObject object = module.newObject( FromObject.class );
+            object.belowModuleVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromObjectWhenAccessingAboveApplicationVisibleExpectException()
     {
-        FromObject object = module.newObject( FromObject.class );
-        object.aboveApplicationVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromObject object = module.newObject( FromObject.class );
+            object.aboveApplicationVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromObjectWhenAccessingAboveLayerVisibleExpectException()
     {
-        FromObject object = module.newObject( FromObject.class );
-        object.aboveLayerVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromObject object = module.newObject( FromObject.class );
+            object.aboveLayerVisible();
+        } );
     }
 
-    @Test( expected = NoSuchServiceTypeException.class )
+    @Test
     public void givenFromObjectWhenAccessingAboveModuleVisibleExpectException()
     {
-        FromObject object = module.newObject( FromObject.class );
-        object.aboveModuleVisible();
+        assertThrows( NoSuchServiceTypeException.class, () -> {
+            FromObject object = module.newObject( FromObject.class );
+            object.aboveModuleVisible();
+        } );
     }
 
     private static class FromAssembler

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java
index 4ff5e2b..ed1dd2d 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java
@@ -21,8 +21,6 @@
 package org.apache.polygene.runtime.sideeffects;
 
 import java.lang.reflect.Method;
-import org.apache.polygene.test.AbstractPolygeneTest;
-import org.junit.Test;
 import org.apache.polygene.api.common.AppliesTo;
 import org.apache.polygene.api.common.AppliesToFilter;
 import org.apache.polygene.api.common.UseDefaults;
@@ -34,10 +32,12 @@ import org.apache.polygene.api.sideeffect.GenericSideEffect;
 import org.apache.polygene.api.sideeffect.SideEffects;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 /**
  * JAVADOC

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/ModuleSideEffectTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/ModuleSideEffectTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/ModuleSideEffectTest.java
index 78f2d9c..557381f 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/ModuleSideEffectTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/ModuleSideEffectTest.java
@@ -22,15 +22,16 @@ package org.apache.polygene.runtime.sideeffects;
 
 import java.lang.reflect.Method;
 import java.util.Arrays;
-import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
-import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.sideeffect.GenericSideEffect;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.test.AbstractPolygeneTest;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
 
 /**
  * Test of declaring sideeffect in assembly
@@ -50,7 +51,7 @@ public class ModuleSideEffectTest
     public void testModuleSideEffect()
     {
         transientBuilderFactory.newTransient( Foo.class ).test( "Foo", 42 );
-        Assert.assertThat( "SideEffect has been called", ok, CoreMatchers.equalTo( true ) );
+        assertThat( "SideEffect has been called", ok, equalTo( true ) );
     }
 
     @Mixins( FooMixin.class )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java
index 022f1f0..913d84f 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java
@@ -20,8 +20,6 @@
 
 package org.apache.polygene.runtime.sideeffects;
 
-import org.apache.polygene.test.AbstractPolygeneTest;
-import org.junit.Test;
 import org.apache.polygene.api.common.UseDefaults;
 import org.apache.polygene.api.composite.TransientBuilderFactory;
 import org.apache.polygene.api.injection.scope.Structure;
@@ -31,9 +29,11 @@ import org.apache.polygene.api.sideeffect.SideEffectOf;
 import org.apache.polygene.api.sideeffect.SideEffects;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 public class SampleTransientTest extends AbstractPolygeneTest
 {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SpecificSideEffectTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SpecificSideEffectTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SpecificSideEffectTest.java
index 0c7daae..60c8588 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SpecificSideEffectTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SpecificSideEffectTest.java
@@ -30,10 +30,10 @@ import org.apache.polygene.api.sideeffect.SideEffects;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.test.AbstractPolygeneTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 /**
  * Test for adding side-effects to methods specified by domain interfaces

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ApplicationModeTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ApplicationModeTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ApplicationModeTest.java
index 61c1a1d..009aa02 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ApplicationModeTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ApplicationModeTest.java
@@ -20,15 +20,17 @@
 
 package org.apache.polygene.runtime.structure;
 
-import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
-import org.junit.Test;
 import org.apache.polygene.api.activation.ActivationException;
 import org.apache.polygene.api.structure.Application;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.apache.polygene.test.AbstractPolygeneTest;
+import org.hamcrest.CoreMatchers;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
 
 public class ApplicationModeTest
     extends AbstractPolygeneTest
@@ -43,9 +45,7 @@ public class ApplicationModeTest
     public void testApplicationModeNotSet()
     {
         // mode is set to test in AbstractPolygeneTest
-        Assert.assertThat( "mode set to default",
-                           application.mode(),
-                           CoreMatchers.equalTo( Application.Mode.test ) );
+        assertThat( "mode set to default", application.mode(), equalTo( Application.Mode.test ) );
     }
 
     @Test
@@ -61,7 +61,7 @@ public class ApplicationModeTest
             }
         }.application().mode();
 
-        Assert.assertThat( "mode set to given value", mode, CoreMatchers.equalTo( Application.Mode.test ) );
+        assertThat( "mode set to given value", mode, CoreMatchers.equalTo( Application.Mode.test ) );
     }
 
     @Test
@@ -77,7 +77,7 @@ public class ApplicationModeTest
             }
         }.application().mode();
 
-        Assert.assertThat( "mode set to given value", mode, CoreMatchers.equalTo( Application.Mode.staging ) );
+        assertThat( "mode set to given value", mode, CoreMatchers.equalTo( Application.Mode.staging ) );
     }
 
     @Test
@@ -93,7 +93,7 @@ public class ApplicationModeTest
             }
         }.application().mode();
 
-        Assert.assertThat( "mode set to given value", mode, CoreMatchers.equalTo( Application.Mode.development ) );
+        assertThat( "mode set to given value", mode, CoreMatchers.equalTo( Application.Mode.development ) );
     }
 
     @Test
@@ -109,6 +109,6 @@ public class ApplicationModeTest
             }
         }.application().mode();
 
-        Assert.assertThat( "mode set to given value", mode, CoreMatchers.equalTo( Application.Mode.production ) );
+        assertThat( "mode set to given value", mode, CoreMatchers.equalTo( Application.Mode.production ) );
     }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/structure/CompositeDescriptorTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/CompositeDescriptorTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/CompositeDescriptorTest.java
index af1d815..be17556 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/CompositeDescriptorTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/CompositeDescriptorTest.java
@@ -25,11 +25,12 @@ import org.apache.polygene.api.composite.TransientDescriptor;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.test.AbstractPolygeneTest;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.IsNull.notNullValue;
 
 public class CompositeDescriptorTest
     extends AbstractPolygeneTest
@@ -42,9 +43,9 @@ public class CompositeDescriptorTest
         AddressComposite address = transientBuilderFactory.newTransient( AddressComposite.class );
         CompositeDescriptor addressDescriptor = spi.compositeDescriptorFor( address );
 
-        assertNotNull( addressDescriptor );
-        assertEquals( AddressComposite.class, addressDescriptor.types().findFirst().orElse( null ) );
-        assertTrue( TransientDescriptor.class.isAssignableFrom( addressDescriptor.getClass() ) );
+        assertThat( addressDescriptor, notNullValue() );
+        assertThat( addressDescriptor.types().findFirst().orElse( null ), equalTo( AddressComposite.class ) );
+        assertThat( TransientDescriptor.class.isAssignableFrom( addressDescriptor.getClass() ), is( true ) );
     }
 
     @Test
@@ -55,9 +56,9 @@ public class CompositeDescriptorTest
         AddressComposite address = transientBuilderFactory.newTransient( AddressComposite.class );
         TransientDescriptor addressDescriptor = spi.transientDescriptorFor( address );
 
-        assertNotNull( addressDescriptor );
-        assertEquals( AddressComposite.class, addressDescriptor.types().findFirst().orElse( null ) );
-        assertTrue( TransientDescriptor.class.isAssignableFrom( addressDescriptor.getClass() ) );
+        assertThat( addressDescriptor, notNullValue() );
+        assertThat( addressDescriptor.types().findFirst().orElse( null ), equalTo( AddressComposite.class ) );
+        assertThat( TransientDescriptor.class.isAssignableFrom( addressDescriptor.getClass() ), is( true ) );
     }
 
     @Test
@@ -65,9 +66,9 @@ public class CompositeDescriptorTest
     {
         // Test with composite
         TransientDescriptor addressDesc = module.transientDescriptor( AddressComposite.class.getName() );
-        assertNotNull( addressDesc );
+        assertThat( addressDesc, notNullValue() );
 
-        assertEquals( AddressComposite.class, addressDesc.types().findFirst().orElse( null ) );
+        assertThat( addressDesc.types().findFirst().orElse( null ), equalTo( AddressComposite.class ) );
     }
 
     public final void assemble( ModuleAssembly aModule )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java
index 1174e2b..3285f09 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java
@@ -34,9 +34,11 @@ import org.apache.polygene.bootstrap.ApplicationAssemblerAdapter;
 import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.Energy4Java;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * JAVADOC
@@ -66,67 +68,73 @@ public class MixinVisibilityTest
         } );
         app.activate();
         ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
-        assertEquals( "ok", object.test1() );
-        assertEquals( "abc", object.test2() );
+        assertThat( object.test1(), equalTo( "ok" ) );
+        assertThat( object.test2(), equalTo( "abc" ) );
     }
 
-    @Test( expected = AmbiguousTypeException.class )
+    @Test
     public void testMultipleMixinsInModuleWillFail()
         throws Exception
     {
-        Energy4Java polygene = new Energy4Java();
-        Assembler[][][] assemblers = new Assembler[][][]
-            {
-                { // Layer
-                  {  // Module 1
-                     module -> {
-                         module.setName( "Module A" );
-                         module.transients( B1Composite.class, B2Composite.class );
-                         module.objects( ObjectA.class );
-                     }
-                  }
-                }
-            };
+        assertThrows( AmbiguousTypeException.class, () -> {
 
-        Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
-        {
+            Energy4Java polygene = new Energy4Java();
+            Assembler[][][] assemblers = new Assembler[][][]
+                {
+                    { // Layer
+                      {  // Module 1
+                         module -> {
+                             module.setName( "Module A" );
+                             module.transients( B1Composite.class, B2Composite.class );
+                             module.objects( ObjectA.class );
+                         }
+                      }
+                    }
+                };
+
+            Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
+            {
+            } );
+            app.activate();
+            ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
+            assertThat( object.test1(), equalTo( "ok" ) );
+            assertThat( object.test2(), equalTo( "abc" ) );
         } );
-        app.activate();
-        ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
-        assertEquals( "ok", object.test1() );
-        assertEquals( "abc", object.test2() );
     }
 
-    @Test( expected = NoSuchTransientTypeException.class )
+    @Test
     public void testMixinInLayerIsNotVisible()
         throws Exception
     {
-        Energy4Java polygene = new Energy4Java();
-        Assembler[][][] assemblers = new Assembler[][][]
-            {
-                { // Layer
-                  {
-                      module -> {
-                          module.setName( "Module A" );
-                          module.objects( ObjectA.class );
-                      }
-                  },
-                  {
-                      module -> {
-                          module.setName( "Module B" );
-                          module.transients( B1Composite.class );
+        assertThrows( NoSuchTransientTypeException.class, () -> {
+
+            Energy4Java polygene = new Energy4Java();
+            Assembler[][][] assemblers = new Assembler[][][]
+                {
+                    { // Layer
+                      {
+                          module -> {
+                              module.setName( "Module A" );
+                              module.objects( ObjectA.class );
+                          }
+                      },
+                      {
+                          module -> {
+                              module.setName( "Module B" );
+                              module.transients( B1Composite.class );
+                          }
                       }
-                  }
-                }
-            };
+                    }
+                };
 
-        Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
-        {
+            Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
+            {
+            } );
+            app.activate();
+            ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
+            assertThat( object.test1(), equalTo( "ok" ) );
+            assertThat( object.test2(), equalTo( "abc" ) );
         } );
-        app.activate();
-        ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
-        assertEquals( "ok", object.test1() );
-        assertEquals( "abc", object.test2() );
     }
 
     @Test
@@ -157,79 +165,85 @@ public class MixinVisibilityTest
         } );
         app.activate();
         ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
-        assertEquals( "ok", object.test1() );
-        assertEquals( "abc", object.test2() );
+        assertThat( object.test1(), equalTo( "ok" ) );
+        assertThat( object.test2(), equalTo( "abc" ) );
     }
 
-    @Test( expected = AmbiguousTypeException.class )
+    @Test
     public void testMultipleMixinsInLayerWillFailSameModule()
         throws Exception
     {
-        Energy4Java polygene = new Energy4Java();
-        Assembler[][][] assemblers = new Assembler[][][]
-            {
-                { // Layer
-                  {
-                      module -> {
-                          module.setName( "Module A" );
-                          module.objects( ObjectA.class );
-                      }
-                  },
-                  {
-                      module -> {
-                          module.setName( "Module B" );
-                          module.transients( B1Composite.class, B2Composite.class )
-                                .visibleIn( Visibility.layer );
+        assertThrows( AmbiguousTypeException.class, () -> {
+
+            Energy4Java polygene = new Energy4Java();
+            Assembler[][][] assemblers = new Assembler[][][]
+                {
+                    { // Layer
+                      {
+                          module -> {
+                              module.setName( "Module A" );
+                              module.objects( ObjectA.class );
+                          }
+                      },
+                      {
+                          module -> {
+                              module.setName( "Module B" );
+                              module.transients( B1Composite.class, B2Composite.class )
+                                  .visibleIn( Visibility.layer );
+                          }
                       }
-                  }
-                }
-            };
+                    }
+                };
 
-        Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
-        {
+            Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
+            {
+            } );
+            app.activate();
+            ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
+            assertThat( object.test1(), equalTo( "ok" ) );
+            assertThat( object.test2(), equalTo( "abc" ) );
         } );
-        app.activate();
-        ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
-        assertEquals( "ok", object.test1() );
-        assertEquals( "abc", object.test2() );
     }
 
-    @Test( expected = AmbiguousTypeException.class )
+    @Test
     public void testMultipleMixinsInLayerWillFailDiffModule()
         throws Exception
     {
-        Energy4Java polygene = new Energy4Java();
-        Assembler[][][] assemblers = new Assembler[][][]
-            {
-                { // Layer
-                  { // Module 1
-                    module -> {
-                        module.setName( "Module A" );
-                        module.objects( ObjectA.class );
-                    }
-                  },
-                  { // Module 2
-                    module -> {
-                        module.setName( "Module B" );
-                        module.transients( B1Composite.class ).visibleIn( Visibility.layer );
-                    }
-                  },
-                  { // Module 3
-                    module -> {
-                        module.setName( "Module C" );
-                        module.transients( B2Composite.class ).visibleIn( Visibility.layer );
+        assertThrows( AmbiguousTypeException.class, () -> {
+
+            Energy4Java polygene = new Energy4Java();
+            Assembler[][][] assemblers = new Assembler[][][]
+                {
+                    { // Layer
+                      { // Module 1
+                        module -> {
+                            module.setName( "Module A" );
+                            module.objects( ObjectA.class );
+                        }
+                      },
+                      { // Module 2
+                        module -> {
+                            module.setName( "Module B" );
+                            module.transients( B1Composite.class ).visibleIn( Visibility.layer );
+                        }
+                      },
+                      { // Module 3
+                        module -> {
+                            module.setName( "Module C" );
+                            module.transients( B2Composite.class ).visibleIn( Visibility.layer );
+                        }
+                      }
                     }
-                  }
-                }
-            };
+                };
 
-        Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
-        {
+            Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
+            {
+            } );
+            app.activate();
+            ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
+            assertThat( object.test1(), equalTo( "ok" ) );
+            assertThat( object.test2(), equalTo( "abc" ) );
         } );
-        app.activate();
-        ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
-        assertEquals( "ok", object.test1() );
-        assertEquals( "abc", object.test2() );
     }
 
     // @Test( expected= MixinTypeNotAvailableException.class )
@@ -264,8 +278,8 @@ public class MixinVisibilityTest
         } );
         app.activate();
         ObjectA object = app.findModule( "Layer 1", "Module " ).newObject( ObjectA.class );
-        assertEquals( "ok", object.test1() );
-        assertEquals( "abc", object.test2() );
+        assertThat( object.test1(), equalTo( "ok" ) );
+        assertThat( object.test2(), equalTo( "abc" ) );
     }
 
     @Test
@@ -298,8 +312,8 @@ public class MixinVisibilityTest
         } );
         app.activate();
         ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
-        assertEquals( "ok", object.test1() );
-        assertEquals( "abc", object.test2() );
+        assertThat( object.test1(), equalTo( "ok" ) );
+        assertThat( object.test2(), equalTo( "abc" ) );
     }
 
     class AssemblerB

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java
index 3e746b4..53a5d98 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java
@@ -29,10 +29,10 @@ import org.apache.polygene.api.structure.Module;
 import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 /**
  * Test of the Module interface. This should satisfiedBy both the general interface and all possible visibility

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/structure/NoSuchEntityTypeExceptionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/NoSuchEntityTypeExceptionTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/NoSuchEntityTypeExceptionTest.java
index a65802b..b1da1ba 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/NoSuchEntityTypeExceptionTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/NoSuchEntityTypeExceptionTest.java
@@ -28,14 +28,13 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
 import org.apache.polygene.test.entity.model.AbstractPolygeneMultiLayeredTestWithModel;
 import org.apache.polygene.test.entity.model.monetary.CheckBookSlip;
-import org.apache.polygene.test.entity.model.monetary.Currency;
 import org.apache.polygene.test.entity.model.people.Person;
 import org.apache.polygene.test.entity.model.people.Rent;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.StringContains.containsString;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
 
 public class NoSuchEntityTypeExceptionTest extends AbstractPolygeneMultiLayeredTestWithModel
 {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/structure/PrivateCompositeVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/PrivateCompositeVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/PrivateCompositeVisibilityTest.java
index 70ef4b8..f1b0c84 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/PrivateCompositeVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/PrivateCompositeVisibilityTest.java
@@ -32,35 +32,39 @@ import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * JAVADOC
  */
 public class PrivateCompositeVisibilityTest
 {
-    @Test( expected = NoSuchTransientTypeException.class )
+    @Test
     public void testPrivateCompositeVisibility()
         throws Exception
     {
-        Energy4Java polygene = new Energy4Java();
-        Assembler[][][] assemblers = new Assembler[][][]
+        assertThrows( NoSuchTransientTypeException.class, () -> {
+            Energy4Java polygene = new Energy4Java();
+            Assembler[][][] assemblers = new Assembler[][][]
+                {
+                    { // Layer
+                      {
+                          new AssemblerA()
+                      },
+                      {
+                          new AssemblerB()
+                      }
+                    }
+                };
+            Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
             {
-                { // Layer
-                  {
-                      new AssemblerA()
-                  },
-                  {
-                      new AssemblerB()
-                  }
-                }
-            };
-        Application app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
-        {
+            } );
+            app.activate();
+            ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
+            object.test();
         } );
-        app.activate();
-        ObjectA object = app.findModule( "Layer 1", "Module A" ).newObject( ObjectA.class );
-        object.test();
     }
 
     class AssemblerA

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java
index aba2f3b..8c1c21a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java
@@ -27,7 +27,7 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
 import org.apache.polygene.bootstrap.LayerAssembly;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 /**
  * JAVADOC

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/structure/TypeToCompositeLookupTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/TypeToCompositeLookupTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/TypeToCompositeLookupTest.java
index 3df3b38..6c96122 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/TypeToCompositeLookupTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/TypeToCompositeLookupTest.java
@@ -34,11 +34,12 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.apache.polygene.test.EntityTestAssembler;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * Theses tests ensure that Type to Composite lookup work as expected for
@@ -107,9 +108,9 @@ public class TypeToCompositeLookupTest
 
         }.module();
 
-        assertEquals( CATHEDRAL, module.newObject( SomeOtherFooImpl.class ).bar() );
-        assertEquals( CATHEDRAL, module.newObject( BasicFooImpl.class ).bar() );
-        assertEquals( CATHEDRAL, module.newObject( Foo.class ).bar() );
+        assertThat( module.newObject( SomeOtherFooImpl.class ).bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.newObject( BasicFooImpl.class ).bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.newObject( Foo.class ).bar(), equalTo( CATHEDRAL ) );
     }
 
     @Test
@@ -128,8 +129,8 @@ public class TypeToCompositeLookupTest
 
         }.module();
 
-        assertEquals( CATHEDRAL, module.newObject( SomeOtherFooImpl.class ).bar() );
-        assertEquals( BAZAR, module.newObject( BasicFooImpl.class ).bar() );
+        assertThat( module.newObject( SomeOtherFooImpl.class ).bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.newObject( BasicFooImpl.class ).bar(), equalTo( BAZAR ) );
 
         try
         {
@@ -157,9 +158,9 @@ public class TypeToCompositeLookupTest
 
         }.module();
 
-        assertEquals( CATHEDRAL, module.newTransientBuilder( SomeOtherFoo.class ).newInstance().bar() );
-        assertEquals( CATHEDRAL, module.newTransientBuilder( BasicFoo.class ).newInstance().bar() );
-        assertEquals( CATHEDRAL, module.newTransientBuilder( Foo.class ).newInstance().bar() );
+        assertThat( module.newTransientBuilder( SomeOtherFoo.class ).newInstance().bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.newTransientBuilder( BasicFoo.class ).newInstance().bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.newTransientBuilder( Foo.class ).newInstance().bar(), equalTo( CATHEDRAL ) );
     }
 
     @Test
@@ -178,8 +179,8 @@ public class TypeToCompositeLookupTest
 
         }.module();
 
-        assertEquals( CATHEDRAL, module.newTransientBuilder( SomeOtherFoo.class ).newInstance().bar() );
-        assertEquals( BAZAR, module.newTransientBuilder( BasicFoo.class ).newInstance().bar() );
+        assertThat( module.newTransientBuilder( SomeOtherFoo.class ).newInstance().bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.newTransientBuilder( BasicFoo.class ).newInstance().bar(), equalTo( BAZAR ) );
 
         try
         {
@@ -207,9 +208,9 @@ public class TypeToCompositeLookupTest
 
         }.module();
 
-        assertEquals( CATHEDRAL, module.newValueBuilder( SomeOtherFoo.class ).newInstance().bar() );
-        assertEquals( CATHEDRAL, module.newValueBuilder( BasicFoo.class ).newInstance().bar() );
-        assertEquals( CATHEDRAL, module.newValueBuilder( Foo.class ).newInstance().bar() );
+        assertThat( module.newValueBuilder( SomeOtherFoo.class ).newInstance().bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.newValueBuilder( BasicFoo.class ).newInstance().bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.newValueBuilder( Foo.class ).newInstance().bar(), equalTo( CATHEDRAL ) );
     }
 
     @Test
@@ -228,8 +229,8 @@ public class TypeToCompositeLookupTest
 
         }.module();
 
-        assertEquals( CATHEDRAL, module.newValueBuilder( SomeOtherFoo.class ).newInstance().bar() );
-        assertEquals( BAZAR, module.newValueBuilder( BasicFoo.class ).newInstance().bar() );
+        assertThat( module.newValueBuilder( SomeOtherFoo.class ).newInstance().bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.newValueBuilder( BasicFoo.class ).newInstance().bar(), equalTo( BAZAR ) );
 
         try
         {
@@ -264,9 +265,9 @@ public class TypeToCompositeLookupTest
         BasicFoo basicFoo = uow.newEntityBuilder( BasicFoo.class ).newInstance();
         Foo foo = uow.newEntityBuilder( Foo.class ).newInstance();
 
-        assertEquals( CATHEDRAL, someOtherFoo.bar() );
-        assertEquals( CATHEDRAL, basicFoo.bar() );
-        assertEquals( CATHEDRAL, foo.bar() );
+        assertThat( someOtherFoo.bar(), equalTo( CATHEDRAL ) );
+        assertThat( basicFoo.bar(), equalTo( CATHEDRAL ) );
+        assertThat( foo.bar(), equalTo( CATHEDRAL ) );
 
         Identity someOtherFooIdentity = ((HasIdentity) someOtherFoo).identity().get();
         Identity basicFooIdentity = ((HasIdentity) basicFoo).identity().get();
@@ -314,10 +315,10 @@ public class TypeToCompositeLookupTest
         }
 
         // Specific Type used
-        assertEquals( CATHEDRAL, uow.newEntityBuilder( SomeOtherFoo.class ).newInstance().bar() );
+        assertThat( uow.newEntityBuilder( SomeOtherFoo.class ).newInstance().bar(), equalTo( CATHEDRAL ) );
 
         // Specific Type used
-        assertEquals( BAZAR, uow.newEntityBuilder( BasicFoo.class ).newInstance().bar() );
+        assertThat( uow.newEntityBuilder( BasicFoo.class ).newInstance().bar(), equalTo( BAZAR ) );
 
         Identity someOtherFooIdentity = ((HasIdentity) someOtherFoo).identity().get();
         Identity basicFooIdentity = ((HasIdentity) basicFoo).identity().get();
@@ -326,10 +327,10 @@ public class TypeToCompositeLookupTest
 
         uow = uowf.newUnitOfWork();
 
-        assertEquals( CATHEDRAL, uow.get( SomeOtherFoo.class, someOtherFooIdentity ).bar() );
-        assertEquals( BAZAR, uow.get( BasicFoo.class, basicFooIdentity ).bar() );
-        assertEquals( CATHEDRAL, uow.get( Foo.class, someOtherFooIdentity ).bar() );
-        assertEquals( BAZAR, uow.get( Foo.class, basicFooIdentity ).bar() );
+        assertThat( uow.get( SomeOtherFoo.class, someOtherFooIdentity ).bar(), equalTo( CATHEDRAL ) );
+        assertThat( uow.get( BasicFoo.class, basicFooIdentity ).bar(), equalTo( BAZAR ) );
+        assertThat( uow.get( Foo.class, someOtherFooIdentity ).bar(), equalTo( CATHEDRAL ) );
+        assertThat( uow.get( Foo.class, basicFooIdentity ).bar(), equalTo( BAZAR ) );
 
         uow.discard();
     }
@@ -350,9 +351,9 @@ public class TypeToCompositeLookupTest
 
         }.module();
 
-        assertEquals( CATHEDRAL, module.findService( SomeOtherFoo.class ).get().bar() );
-        assertEquals( CATHEDRAL, module.findService( BasicFoo.class ).get().bar() );
-        assertEquals( CATHEDRAL, module.findService( Foo.class ).get().bar() );
+        assertThat( module.findService( SomeOtherFoo.class ).get().bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.findService( BasicFoo.class ).get().bar(), equalTo( CATHEDRAL ) );
+        assertThat( module.findService( Foo.class ).get().bar(), equalTo( CATHEDRAL ) );
     }
 
     @Test
@@ -371,23 +372,23 @@ public class TypeToCompositeLookupTest
 
         }.module();
 
-        assertEquals( 1, module.findServices( SomeOtherFoo.class ).count() );
-        assertEquals( 2, module.findServices( BasicFoo.class ).count() );
-        assertEquals( 2, module.findServices( Foo.class ).count() );
+        assertThat( module.findServices( SomeOtherFoo.class ).count(), equalTo( 1 ) );
+        assertThat( module.findServices( BasicFoo.class ).count(), equalTo( 2 ) );
+        assertThat( module.findServices( Foo.class ).count(), equalTo( 2 ) );
 
-        assertEquals( CATHEDRAL, module.findService( SomeOtherFoo.class ).get().bar() );
+        assertThat( module.findService( SomeOtherFoo.class ).get().bar(), equalTo( CATHEDRAL ) );
 
         // Exact type match first even if it is assembled _after_ an assignable, the assignable comes after
         Iterator<ServiceReference<BasicFoo>> basicFoos = module.findServices( BasicFoo.class ).iterator();
-        assertEquals( BAZAR, basicFoos.next().get().bar() );
-        assertEquals( CATHEDRAL, basicFoos.next().get().bar() );
-        assertFalse( basicFoos.hasNext() );
+        assertThat( basicFoos.next().get().bar(), equalTo( BAZAR ) );
+        assertThat( basicFoos.next().get().bar(), equalTo( CATHEDRAL ) );
+        assertThat( basicFoos.hasNext(), is( false ) );
 
         // No exact type match, all assembled are assignable, follows assembly Type order
         Iterator<ServiceReference<Foo>> foos = module.findServices( Foo.class ).iterator();
-        assertEquals( CATHEDRAL, foos.next().get().bar() );
-        assertEquals( BAZAR, foos.next().get().bar() );
-        assertFalse( foos.hasNext() );
+        assertThat( foos.next().get().bar(), equalTo( CATHEDRAL ) );
+        assertThat( foos.next().get().bar(), equalTo( BAZAR ) );
+        assertThat( foos.hasNext(), is( false ) );
     }
 
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java
index fcc0ee8..db9205f 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java
@@ -19,8 +19,6 @@
  */
 package org.apache.polygene.runtime.threaded;
 
-import org.apache.polygene.test.AbstractPolygeneTest;
-import org.junit.Test;
 import org.apache.polygene.api.common.UseDefaults;
 import org.apache.polygene.api.composite.CompositeContext;
 import org.apache.polygene.api.composite.TransientBuilder;
@@ -28,8 +26,11 @@ import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
 
 public class ContextCompositeTest
     extends AbstractPolygeneTest
@@ -58,9 +59,9 @@ public class ContextCompositeTest
             w2.join();
             System.out.println( "W1: " + w1.getData() );
             System.out.println( "W2: " + w2.getData() );
-            assertEquals( 0, (int) c1.data().get() );
-            assertEquals( 100, w1.getData() );
-            assertEquals( 400, w2.getData() );
+            assertThat( (int) c1.data().get(), equalTo( 0 ) );
+            assertThat( w1.getData(), equalTo( 100 ) );
+            assertThat( w2.getData(), equalTo( 400 ) );
         }
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/6ae17138/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientBuilderFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientBuilderFactoryTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientBuilderFactoryTest.java
index 95dbfff..2d5d640 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientBuilderFactoryTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientBuilderFactoryTest.java
@@ -21,8 +21,6 @@
 package org.apache.polygene.runtime.transients;
 
 import java.lang.reflect.Method;
-import org.hamcrest.core.IsEqual;
-import org.junit.Test;
 import org.apache.polygene.api.activation.ActivationException;
 import org.apache.polygene.api.common.UseDefaults;
 import org.apache.polygene.api.composite.NoSuchTransientTypeException;
@@ -38,8 +36,11 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.apache.polygene.library.constraints.annotation.MaxLength;
+import org.hamcrest.core.IsEqual;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 
 /**
  * Unit tests for CompositeBuilderFactory.
@@ -52,18 +53,20 @@ public class TransientBuilderFactoryTest
      *
      * @throws Exception expected
      */
-    @Test( expected = NoSuchTransientTypeException.class )
+    @Test
     public void newBuilderForUnregisteredComposite()
         throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
+        assertThrows( NoSuchTransientTypeException.class, () -> {
+            SingletonAssembler assembler = new SingletonAssembler()
             {
-            }
-        };
-        assembler.module().newTransientBuilder( AnyComposite.class );
+                public void assemble( ModuleAssembly module )
+                    throws AssemblyException
+                {
+                }
+            };
+            assembler.module().newTransientBuilder( AnyComposite.class );
+        } );
     }
 
     /**
@@ -71,18 +74,20 @@ public class TransientBuilderFactoryTest
      *
      * @throws Exception expected
      */
-    @Test( expected = NullPointerException.class )
+    @Test
     public void newBuilderForNullType()
         throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
+        assertThrows( NullPointerException.class, () -> {
+            SingletonAssembler assembler = new SingletonAssembler()
             {
-            }
-        };
-        assembler.module().newTransientBuilder( null );
+                public void assemble( ModuleAssembly module )
+                    throws AssemblyException
+                {
+                }
+            };
+            assembler.module().newTransientBuilder( null );
+        } );
     }
 
     /**
@@ -90,18 +95,20 @@ public class TransientBuilderFactoryTest
      *
      * @throws Exception expected
      */
-    @Test( expected = NullPointerException.class )
+    @Test
     public void newInstanceForNullType()
         throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
+        assertThrows( NullPointerException.class, () -> {
+            SingletonAssembler assembler = new SingletonAssembler()
             {
-            }
-        };
-        assembler.module().newTransient( null );
+                public void assemble( ModuleAssembly module )
+                    throws AssemblyException
+                {
+                }
+            };
+            assembler.module().newTransient( null );
+        } );
     }
 
     /**
@@ -140,25 +147,27 @@ public class TransientBuilderFactoryTest
         assembler.module().newTransientBuilder( AnyComposite.class );
     }
 
-    @Test( expected = ConstraintViolationException.class )
+    @Test
     public void testClassAsTransient()
         throws ActivationException, AssemblyException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
+        assertThrows( ConstraintViolationException.class, () -> {
+            SingletonAssembler assembler = new SingletonAssembler()
             {
-                module.transients( AnyTransient.class );
-            }
-        };
+                @Override
+                public void assemble( ModuleAssembly module )
+                    throws AssemblyException
+                {
+                    module.transients( AnyTransient.class );
+                }
+            };
 
-        AnyTransient anyTransient = assembler.module().newTransient( AnyTransient.class );
-        assertThat( anyTransient.hello( "me" ), new IsEqual<>( "Hello ME from Module 1" ) );
+            AnyTransient anyTransient = assembler.module().newTransient( AnyTransient.class );
+            assertThat( anyTransient.hello( "me" ), new IsEqual<>( "Hello ME from Module 1" ) );
 
-        assertThat( anyTransient.hello( "World" ), new IsEqual<>( "Hello WORLD from ME" ) );
-        anyTransient.hello( "Universe" );
+            assertThat( anyTransient.hello( "World" ), new IsEqual<>( "Hello WORLD from ME" ) );
+            anyTransient.hello( "Universe" );
+        } );
     }
 
     public interface AnyComposite


Mime
View raw message