Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 6ae1713

Browse files
committed
Migrating to JUnit5. Intermediary build where all tests of phase 1 compiles, but not necessarily succeeds.
1 parent e647b59 commit 6ae1713

File tree

396 files changed

+4554
-5750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

396 files changed

+4554
-5750
lines changed
-29.6 KB
Binary file not shown.
-31.5 KB
Binary file not shown.
-31.3 KB
Binary file not shown.
-30 KB
Binary file not shown.

core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
import org.apache.polygene.api.value.ValueComposite;
3636
import org.apache.polygene.bootstrap.SingletonAssembler;
3737
import org.apache.polygene.test.EntityTestAssembler;
38-
import org.junit.Assert;
39-
import org.junit.Test;
38+
import org.junit.jupiter.api.Test;
39+
40+
import static org.hamcrest.MatcherAssert.assertThat;
41+
import static org.hamcrest.core.Is.is;
4042

4143
/**
4244
* TODO
@@ -77,18 +79,18 @@ public void testOperators()
7779
{
7880
Predicate<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
7981
.foo(), "Bar" );
80-
Assert.assertTrue( where.test( testEntity ) );
82+
assertThat( where.test( testEntity ), is( true ) );
8183
System.out.println( where );
8284
}
8385
{
8486
Predicate<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
8587
.value()
8688
.get()
8789
.bar(), "Xyz" );
88-
Assert.assertTrue( where.test( testEntity ) );
90+
assertThat( where.test( testEntity ), is( true ) );
8991
System.out.println( where );
9092

91-
Assert.assertTrue( builder.where( where ).newQuery( entities ).find().equals( testEntity ) );
93+
assertThat( builder.where( where ).newQuery( entities ).find().equals( testEntity ), is( true ) );
9294
}
9395
}
9496
finally

core/api/src/test/java/org/apache/polygene/api/activation/ActivationEventsTest.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.ArrayList;
2323
import java.util.Iterator;
2424
import java.util.List;
25-
import org.junit.Test;
2625
import org.apache.polygene.api.activation.ActivationEvent.EventType;
2726
import org.apache.polygene.api.mixin.Mixins;
2827
import org.apache.polygene.api.service.ServiceComposite;
@@ -31,9 +30,15 @@
3130
import org.apache.polygene.bootstrap.AssemblyException;
3231
import org.apache.polygene.bootstrap.ModuleAssembly;
3332
import org.apache.polygene.bootstrap.SingletonAssembler;
33+
import org.junit.jupiter.api.Test;
3434

35-
import static org.junit.Assert.*;
36-
import static org.apache.polygene.api.activation.ActivationEvent.EventType.*;
35+
import static org.apache.polygene.api.activation.ActivationEvent.EventType.ACTIVATED;
36+
import static org.apache.polygene.api.activation.ActivationEvent.EventType.ACTIVATING;
37+
import static org.apache.polygene.api.activation.ActivationEvent.EventType.PASSIVATED;
38+
import static org.apache.polygene.api.activation.ActivationEvent.EventType.PASSIVATING;
39+
import static org.hamcrest.MatcherAssert.assertThat;
40+
import static org.hamcrest.core.Is.is;
41+
import static org.junit.jupiter.api.Assertions.fail;
3742

3843
public class ActivationEventsTest
3944
{
@@ -106,7 +111,7 @@ protected void beforeActivation( Application application )
106111
assertEvent( it.next(), PASSIVATED, "Layer" );
107112
assertEvent( it.next(), PASSIVATED, "Application" );
108113

109-
assertFalse( it.hasNext() );
114+
assertThat( it.hasNext(), is( false ) );
110115
}
111116

112117
@Test
@@ -157,7 +162,7 @@ protected void beforeActivation( Application application )
157162
assertEvent( it.next(), PASSIVATED, "Layer" );
158163
assertEvent( it.next(), PASSIVATED, "Application" );
159164

160-
assertFalse( it.hasNext() );
165+
assertThat( it.hasNext(), is( false ) );
161166
}
162167

163168
@Test
@@ -206,7 +211,7 @@ protected void beforeActivation( Application application )
206211
assertEvent( it.next(), PASSIVATED, "Layer" );
207212
assertEvent( it.next(), PASSIVATED, "Application" );
208213

209-
assertFalse( it.hasNext() );
214+
assertThat( it.hasNext(), is( false ) );
210215

211216
events.clear();
212217
application.activate();
@@ -242,7 +247,7 @@ protected void beforeActivation( Application application )
242247
assertEvent( it.next(), PASSIVATED, "Layer" );
243248
assertEvent( it.next(), PASSIVATED, "Application" );
244249

245-
assertFalse( it.hasNext() );
250+
assertThat( it.hasNext(), is( false ) );
246251
}
247252

248253
private static class EventsRecorder

core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
import org.apache.polygene.api.structure.Module;
3131
import org.apache.polygene.bootstrap.AssemblyException;
3232
import org.apache.polygene.bootstrap.builder.ApplicationBuilder;
33-
import org.junit.Test;
33+
import org.junit.jupiter.api.Test;
3434

3535
import static java.util.Collections.emptyList;
3636
import static java.util.Collections.singletonList;
37+
import static org.hamcrest.MatcherAssert.assertThat;
3738
import static org.hamcrest.core.IsEqual.equalTo;
3839
import static org.hamcrest.core.StringContains.containsString;
39-
import static org.junit.Assert.assertThat;
40-
import static org.junit.Assert.fail;
40+
import static org.junit.jupiter.api.Assertions.fail;
4141

4242
public class PassivationExceptionTest
4343
{

core/api/src/test/java/org/apache/polygene/api/annotation/MixinsTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
package org.apache.polygene.api.annotation;
2121

2222
import java.lang.annotation.Annotation;
23-
import org.junit.Test;
2423
import org.apache.polygene.api.mixin.Mixins;
24+
import org.junit.jupiter.api.Test;
2525

26-
import static org.junit.Assert.assertEquals;
27-
import static org.junit.Assert.assertNotNull;
26+
import static org.hamcrest.MatcherAssert.assertThat;
27+
import static org.hamcrest.core.IsEqual.equalTo;
28+
import static org.hamcrest.core.IsNull.notNullValue;
2829

2930
/**
3031
* Tests public api exposed by Mixins annotation.
@@ -37,9 +38,9 @@ public class MixinsTest
3738
public void retention()
3839
{
3940
Annotation[] annotations = Annotated.class.getDeclaredAnnotations();
40-
assertNotNull( "annotations should not be null", annotations );
41-
assertEquals( "number of annotations", 1, annotations.length );
42-
assertEquals( "annotation type", Mixins.class, annotations[ 0 ].annotationType() );
41+
assertThat( "annotations should not be null", annotations, notNullValue() );
42+
assertThat( "number of annotations", annotations.length, equalTo( 1 ) );
43+
assertThat( "annotation type", annotations[ 0 ].annotationType(), equalTo( Mixins.class ) );
4344
}
4445

4546
@Mixins( Object.class )

core/api/src/test/java/org/apache/polygene/api/annotation/ModifiedByTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
package org.apache.polygene.api.annotation;
2121

2222
import java.lang.annotation.Annotation;
23-
import org.junit.Test;
2423
import org.apache.polygene.api.concern.Concerns;
24+
import org.junit.jupiter.api.Test;
2525

26-
import static org.junit.Assert.assertEquals;
27-
import static org.junit.Assert.assertNotNull;
26+
import static org.hamcrest.MatcherAssert.assertThat;
27+
import static org.hamcrest.core.IsEqual.equalTo;
28+
import static org.hamcrest.core.IsNull.notNullValue;
2829

2930
/**
3031
* Tests public api exposed by Concerns annotation.
@@ -37,9 +38,9 @@ public class ModifiedByTest
3738
public void retention()
3839
{
3940
Annotation[] annotations = Annotated.class.getDeclaredAnnotations();
40-
assertNotNull( "annotations should not be null", annotations );
41-
assertEquals( "number of annotations", 1, annotations.length );
42-
assertEquals( "annotation type", Concerns.class, annotations[ 0 ].annotationType() );
41+
assertThat( "annotations should not be null", annotations, notNullValue() );
42+
assertThat( "number of annotations", annotations.length, equalTo( 1 ) );
43+
assertThat( "annotation type", annotations[ 0 ].annotationType(), equalTo( Concerns.class ) );
4344
}
4445

4546
@Concerns( Object.class )

core/api/src/test/java/org/apache/polygene/api/annotation/scope/ModifiesTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
package org.apache.polygene.api.annotation.scope;
2121

2222
import java.lang.annotation.Annotation;
23-
import org.junit.Test;
2423
import org.apache.polygene.api.concern.internal.ConcernFor;
24+
import org.junit.jupiter.api.Test;
2525

26-
import static org.junit.Assert.assertEquals;
27-
import static org.junit.Assert.assertNotNull;
26+
import static org.hamcrest.MatcherAssert.assertThat;
27+
import static org.hamcrest.core.IsEqual.equalTo;
28+
import static org.hamcrest.core.IsNull.notNullValue;
2829

2930
/**
3031
* Tests public api exposed by Modified annotation.
@@ -38,9 +39,9 @@ public void retention()
3839
throws NoSuchFieldException
3940
{
4041
Annotation[] annotations = Annotated.class.getDeclaredField( "modified" ).getDeclaredAnnotations();
41-
assertNotNull( "annotations should not be null", annotations );
42-
assertEquals( "number of annotations", 1, annotations.length );
43-
assertEquals( "annotation type", ConcernFor.class, annotations[ 0 ].annotationType() );
42+
assertThat( "annotations should not be null", annotations, notNullValue() );
43+
assertThat( "number of annotations", annotations.length, equalTo( 1 ) );
44+
assertThat( "annotation type", annotations[ 0 ].annotationType(), equalTo( ConcernFor.class ) );
4445
}
4546

4647
private static class Annotated

0 commit comments

Comments
 (0)