You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/09/13 06:56:55 UTC
[isis] branch master updated: ISIS-3209: migrate applib
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new ee1d9afd9d ISIS-3209: migrate applib
ee1d9afd9d is described below
commit ee1d9afd9dfa2cc0f2b82a56e5fbcf562cf69d93
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Sep 13 08:56:48 2022 +0200
ISIS-3209: migrate applib
---
api/applib/pom.xml | 14 ++++
.../commons/internal/reflection/ReflectTest.java | 9 +-
.../isis/applib/events/InteractionEventTest.java | 39 ++++-----
.../isis/applib/graph/tree/TreePathTest.java | 10 +--
...ropertyLayoutData_renderedAsDayBefore_Test.java | 8 +-
.../component/PropertyLayoutData_repaint_Test.java | 6 +-
.../applib/layout/grid/bootstrap/BSColTest.java | 12 +--
.../applib/layout/grid/bootstrap/SizeSpanTest.java | 9 +-
.../bootstrap/BSMenuBars_roundtrip_Test.java | 10 +--
.../NamedQueryTest_withStart_or_withCount.java | 32 +++----
.../appfeat/ApplicationMemberTypeTest.java | 4 +-
.../eventbus/AbstractDomainEvent_veto_Test.java | 98 +++++++++++-----------
.../exceprecog/ExceptionRecognizerForTypeTest.java | 2 +-
.../exceprecog/ExceptionRecognizerGeneralTest.java | 4 +-
.../services/i18n/TranslatableStringTest.java | 38 ++++-----
.../metamodel/MetaModelService_Config_Test.java | 8 +-
.../QueryResultsCache_KeyTest.java | 36 ++++----
.../wrapper/control/AsyncControl_Test.java | 10 +--
.../services/wrapper/control/SyncControl_Test.java | 26 +++---
.../applib/spec/AbstractSpecification2Test.java | 4 +-
.../applib/spec/AbstractSpecificationTest.java | 4 +-
.../org/apache/isis/applib/util/EnumsTest.java | 4 +-
.../isis/applib/util/EnumsTest_converts.java | 4 +-
.../java/org/apache/isis/applib/util/Invoice.java | 28 ++++---
.../org/apache/isis/applib/util/InvoiceItem.java | 28 ++++---
.../java/org/apache/isis/applib/util/Numbered.java | 28 ++++---
.../apache/isis/applib/util/NumberedEvaluator.java | 28 ++++---
.../applib/util/ObjectContractsTest_compareTo.java | 35 ++++----
.../applib/util/ObjectContractsTest_equals.java | 50 +++++------
.../ObjectContractsTest_equals_and_hashCode.java | 48 ++++++-----
.../applib/util/ObjectContractsTest_toString.java | 52 ++++++------
.../apache/isis/applib/util/ReasonBufferTest.java | 10 +--
.../org/apache/isis/applib/util/ReasonsTest.java | 6 +-
.../apache/isis/applib/util/TitleBufferTest.java | 26 +++---
.../applib/util/schema/CommandDtoUtils_Test.java | 6 +-
...eractionDtoUtilsTest_deriveLogicalMemberId.java | 4 +-
.../isis/applib/value/Blob_constructor_Test.java | 11 ++-
.../isis/applib/value/Clob_constructor_Test.java | 13 +--
.../isis/commons/collections/ImmutableEnumSet.java | 5 +-
.../isis/commons/internal/base/_NullSafe.java | 6 ++
40 files changed, 395 insertions(+), 380 deletions(-)
diff --git a/api/applib/pom.xml b/api/applib/pom.xml
index d1edc7c419..84059f82d6 100644
--- a/api/applib/pom.xml
+++ b/api/applib/pom.xml
@@ -106,6 +106,20 @@
<groupId>org.apache.isis.core</groupId>
<artifactId>isis-core-internaltestsupport</artifactId>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jmock</groupId>
+ <artifactId>jmock-junit4</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
diff --git a/api/applib/src/test/java/org/apache/isis/applib/commons/internal/reflection/ReflectTest.java b/api/applib/src/test/java/org/apache/isis/applib/commons/internal/reflection/ReflectTest.java
index 544b463fcb..bfe8384338 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/commons/internal/reflection/ReflectTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/commons/internal/reflection/ReflectTest.java
@@ -26,6 +26,10 @@ import java.util.stream.Collectors;
import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.commons.internal.collections._Sets;
import org.apache.isis.commons.internal.reflection._Reflect.InterfacePolicy;
@@ -33,9 +37,6 @@ import org.apache.isis.commons.internal.reflection._Reflect.InterfacePolicy;
import static org.apache.isis.commons.internal.reflection._Reflect.getAnnotation;
import static org.apache.isis.commons.internal.reflection._Reflect.streamAllMethods;
import static org.apache.isis.commons.internal.reflection._Reflect.streamTypeHierarchy;
-import static org.junit.Assert.assertTrue;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
import lombok.val;
@@ -131,7 +132,7 @@ class ReflectTest {
// -- HELPER
- private static void assertSetContainsAll(Set<String> shouldContain, Set<String> actuallyContains) {
+ private static void assertSetContainsAll(final Set<String> shouldContain, final Set<String> actuallyContains) {
assertTrue(_Sets.minus(shouldContain, actuallyContains).isEmpty());
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/events/InteractionEventTest.java b/api/applib/src/test/java/org/apache/isis/applib/events/InteractionEventTest.java
index dbcd84ff2e..f2943c8763 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/events/InteractionEventTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/events/InteractionEventTest.java
@@ -18,24 +18,19 @@
*/
package org.apache.isis.applib.events;
-import org.jmock.integration.junit4.JUnitRuleMockery;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.isis.applib.Identifier;
import org.apache.isis.applib.id.LogicalType;
import org.apache.isis.applib.services.wrapper.events.InteractionEvent;
-public class InteractionEventTest {
-
- @Rule
- public final JUnitRuleMockery context = new JUnitRuleMockery();
+class InteractionEventTest {
private InteractionEvent interactionEvent;
@@ -45,12 +40,12 @@ public class InteractionEventTest {
private Class<? extends InteractionEventTest> advisorClass;
private static class CustomerOrder {}
-
- @Before
+
+ @BeforeEach
public void setUp() {
source = new Object();
identifier = Identifier.actionIdentifier(
- LogicalType.fqcn(CustomerOrder.class),
+ LogicalType.fqcn(CustomerOrder.class),
"cancelOrder", new Class[] { String.class, boolean.class });
advisorClass = this.getClass();
}
@@ -59,7 +54,7 @@ public class InteractionEventTest {
public void getIdentifier() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
assertThat(interactionEvent.getIdentifier(), is(identifier));
}
@@ -68,7 +63,7 @@ public class InteractionEventTest {
public void getSource() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
assertThat(interactionEvent.getSource(), is(source));
}
@@ -77,7 +72,7 @@ public class InteractionEventTest {
public void getClassName() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
assertThat(interactionEvent.getClassName(), equalTo(CustomerOrder.class.getCanonicalName()));
}
@@ -86,7 +81,7 @@ public class InteractionEventTest {
public void getClassNaturalName() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
assertThat(interactionEvent.getClassNaturalName(), equalTo("Customer Order"));
}
@@ -95,7 +90,7 @@ public class InteractionEventTest {
public void getMember() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
assertThat(interactionEvent.getMemberName(), equalTo("cancelOrder"));
}
@@ -104,7 +99,7 @@ public class InteractionEventTest {
public void getMemberNaturalName() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
assertThat(interactionEvent.getMemberNaturalName(), equalTo("Cancel Order"));
}
@@ -113,7 +108,7 @@ public class InteractionEventTest {
public void shouldInitiallyNotVeto() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
assertThat(interactionEvent.isVeto(), is(false));
}
@@ -122,7 +117,7 @@ public class InteractionEventTest {
public void afterAdvisedShouldVeto() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
interactionEvent.advised("some reason", this.getClass());
assertThat(interactionEvent.isVeto(), is(true));
@@ -132,7 +127,7 @@ public class InteractionEventTest {
public void afterAdvisedShouldReturnReason() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
interactionEvent.advised("some reason", this.getClass());
assertThat(interactionEvent.isVeto(), is(true));
@@ -142,7 +137,7 @@ public class InteractionEventTest {
public void afterAdvisedShouldReturnAdvisorClass() {
interactionEvent = new InteractionEvent(source, identifier) {
-
+
};
interactionEvent.advised("some reason", advisorClass);
assertEquals(interactionEvent.getAdvisorClass(), advisorClass);
diff --git a/api/applib/src/test/java/org/apache/isis/applib/graph/tree/TreePathTest.java b/api/applib/src/test/java/org/apache/isis/applib/graph/tree/TreePathTest.java
index ac42184a27..33f8384614 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/graph/tree/TreePathTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/graph/tree/TreePathTest.java
@@ -19,18 +19,16 @@
package org.apache.isis.applib.graph.tree;
import org.hamcrest.Matchers;
-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.junit.jupiter.api.Assertions.assertEquals;
-import org.apache.isis.applib.graph.tree.TreePath;
-
-public class TreePathTest {
+class TreePathTest {
@Test
public void rootConstructor() {
- final TreePath treePath = TreePath.root();
+ final TreePath treePath = TreePath.root();
assertThat(treePath.isRoot(), Matchers.is(true));
assertThat(treePath.toString(), Matchers.is("/0"));
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/layout/component/PropertyLayoutData_renderedAsDayBefore_Test.java b/api/applib/src/test/java/org/apache/isis/applib/layout/component/PropertyLayoutData_renderedAsDayBefore_Test.java
index ae3a1e4ac7..06f28eb655 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/layout/component/PropertyLayoutData_renderedAsDayBefore_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/layout/component/PropertyLayoutData_renderedAsDayBefore_Test.java
@@ -16,16 +16,16 @@
*/
package org.apache.isis.applib.layout.component;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-public class PropertyLayoutData_renderedAsDayBefore_Test {
+class PropertyLayoutData_renderedAsDayBefore_Test {
PropertyLayoutData data;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
data = new PropertyLayoutData();
diff --git a/api/applib/src/test/java/org/apache/isis/applib/layout/component/PropertyLayoutData_repaint_Test.java b/api/applib/src/test/java/org/apache/isis/applib/layout/component/PropertyLayoutData_repaint_Test.java
index f3cb74ce10..364e573662 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/layout/component/PropertyLayoutData_repaint_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/layout/component/PropertyLayoutData_repaint_Test.java
@@ -16,8 +16,8 @@
*/
package org.apache.isis.applib.layout.component;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -28,7 +28,7 @@ import org.apache.isis.applib.annotation.Repainting;
public class PropertyLayoutData_repaint_Test {
PropertyLayoutData data;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
data = new PropertyLayoutData();
diff --git a/api/applib/src/test/java/org/apache/isis/applib/layout/grid/bootstrap/BSColTest.java b/api/applib/src/test/java/org/apache/isis/applib/layout/grid/bootstrap/BSColTest.java
index 67558cdef4..b68d1f123a 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/layout/grid/bootstrap/BSColTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/layout/grid/bootstrap/BSColTest.java
@@ -18,21 +18,17 @@
*/
package org.apache.isis.applib.layout.grid.bootstrap;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.apache.isis.applib.layout.grid.bootstrap.BSCol;
-import org.apache.isis.applib.layout.grid.bootstrap.Size;
-import org.apache.isis.applib.layout.grid.bootstrap.SizeSpan;
-
-public class BSColTest {
+class BSColTest {
BSCol bsCol;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
bsCol = new BSCol();
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/layout/grid/bootstrap/SizeSpanTest.java b/api/applib/src/test/java/org/apache/isis/applib/layout/grid/bootstrap/SizeSpanTest.java
index 38dc4a3e44..da5f8519cb 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/layout/grid/bootstrap/SizeSpanTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/layout/grid/bootstrap/SizeSpanTest.java
@@ -18,21 +18,18 @@
*/
package org.apache.isis.applib.layout.grid.bootstrap;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.apache.isis.applib.layout.grid.bootstrap.Size;
-import org.apache.isis.applib.layout.grid.bootstrap.SizeSpan;
-
public class SizeSpanTest {
SizeSpan ss;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
ss = new SizeSpan();
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/layout/menubars/bootstrap/BSMenuBars_roundtrip_Test.java b/api/applib/src/test/java/org/apache/isis/applib/layout/menubars/bootstrap/BSMenuBars_roundtrip_Test.java
index 2ba1da00b0..6b4ad0d008 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/layout/menubars/bootstrap/BSMenuBars_roundtrip_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/layout/menubars/bootstrap/BSMenuBars_roundtrip_Test.java
@@ -18,9 +18,9 @@ package org.apache.isis.applib.layout.menubars.bootstrap;
import javax.xml.bind.JAXBContext;
-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.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@@ -34,12 +34,12 @@ public class BSMenuBars_roundtrip_Test {
private JaxbService jaxbService;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
jaxbService = new JaxbService.Simple();
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/query/NamedQueryTest_withStart_or_withCount.java b/api/applib/src/test/java/org/apache/isis/applib/query/NamedQueryTest_withStart_or_withCount.java
index 881ca858d8..3e2e99935f 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/query/NamedQueryTest_withStart_or_withCount.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/query/NamedQueryTest_withStart_or_withCount.java
@@ -18,14 +18,14 @@
*/
package org.apache.isis.applib.query;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import lombok.val;
@@ -45,12 +45,12 @@ class NamedQueryTest_withStart_or_withCount {
@Test
public void defaults() throws Exception {
-
+
val range = namedQuery.getRange();
-
+
assertThat(range.getStart(), is(0L));
assertThat(range.getLimit(), is(UNLIMITED));
-
+
assertTrue(range.isUnconstrained());
assertFalse(range.hasOffset());
assertFalse(range.hasLimit());
@@ -65,7 +65,7 @@ class NamedQueryTest_withStart_or_withCount {
assertThat(range.getStart(), is(10L));
assertThat(range.getLimit(), is(5L));
-
+
assertFalse(range.isUnconstrained());
assertTrue(range.hasOffset());
assertTrue(range.hasLimit());
@@ -80,7 +80,7 @@ class NamedQueryTest_withStart_or_withCount {
assertThat(range.getStart(), is(10L));
assertThat(range.getLimit(), is(UNLIMITED));
-
+
assertFalse(range.isUnconstrained());
assertTrue(range.hasOffset());
assertFalse(range.hasLimit());
@@ -88,14 +88,14 @@ class NamedQueryTest_withStart_or_withCount {
@Test
public void happyCase_startZero() throws Exception {
-
+
val range = namedQuery
.withRange(QueryRange.start(0L))
.getRange();
assertThat(range.getStart(), is(0L));
assertThat(range.getLimit(), is(UNLIMITED));
-
+
assertTrue(range.isUnconstrained());
assertFalse(range.hasOffset());
assertFalse(range.hasLimit());
@@ -110,14 +110,14 @@ class NamedQueryTest_withStart_or_withCount {
@Test
public void happyCase_countOnly() throws Exception {
-
+
val range = namedQuery
.withRange(QueryRange.limit(10L))
.getRange();
assertThat(range.getStart(), is(0L));
assertThat(range.getLimit(), is(10L));
-
+
assertFalse(range.isUnconstrained());
assertFalse(range.hasOffset());
assertTrue(range.hasLimit());
@@ -132,18 +132,18 @@ class NamedQueryTest_withStart_or_withCount {
@Test
public void countUnlimited() throws Exception {
-
+
val range = namedQuery
.withRange(QueryRange.limit(UNLIMITED))
.getRange();
assertThat(range.getStart(), is(0L));
assertThat(range.getLimit(), is(UNLIMITED));
-
+
assertTrue(range.isUnconstrained());
assertFalse(range.hasOffset());
assertFalse(range.hasLimit());
-
+
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/appfeat/ApplicationMemberTypeTest.java b/api/applib/src/test/java/org/apache/isis/applib/services/appfeat/ApplicationMemberTypeTest.java
index f5a535caef..5cdc153390 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/appfeat/ApplicationMemberTypeTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/services/appfeat/ApplicationMemberTypeTest.java
@@ -18,12 +18,12 @@
*/
package org.apache.isis.applib.services.appfeat;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-public class ApplicationMemberTypeTest {
+class ApplicationMemberTypeTest {
public static class ToString extends ApplicationMemberTypeTest {
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/eventbus/AbstractDomainEvent_veto_Test.java b/api/applib/src/test/java/org/apache/isis/applib/services/eventbus/AbstractDomainEvent_veto_Test.java
index c9947f2058..764b43075d 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/eventbus/AbstractDomainEvent_veto_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/services/eventbus/AbstractDomainEvent_veto_Test.java
@@ -18,18 +18,18 @@
*/
package org.apache.isis.applib.services.eventbus;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.isis.applib.events.domain.AbstractDomainEvent;
import org.apache.isis.applib.services.i18n.TranslatableString;
-public class AbstractDomainEvent_veto_Test {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
+class AbstractDomainEvent_veto_Test {
AbstractDomainEvent<?> ev = new AbstractDomainEvent<Object>() { };
@@ -43,11 +43,11 @@ public class AbstractDomainEvent_veto_Test {
ev.veto((String)null);
// then ... vetoes
- Assert.assertTrue(ev.isHidden());
- Assert.assertFalse(ev.isDisabled());
- Assert.assertNull(ev.getDisabledReason());
- Assert.assertFalse(ev.isInvalid());
- Assert.assertNull(ev.getInvalidityReason());
+ assertTrue(ev.isHidden());
+ assertFalse(ev.isDisabled());
+ assertNull(ev.getDisabledReason());
+ assertFalse(ev.isInvalid());
+ assertNull(ev.getInvalidityReason());
}
@Test
@@ -59,11 +59,11 @@ public class AbstractDomainEvent_veto_Test {
ev.veto("hidden");
// then ... vetoes
- Assert.assertTrue(ev.isHidden());
- Assert.assertFalse(ev.isDisabled());
- Assert.assertNull(ev.getDisabledReason());
- Assert.assertFalse(ev.isInvalid());
- Assert.assertNull(ev.getInvalidityReason());
+ assertTrue(ev.isHidden());
+ assertFalse(ev.isDisabled());
+ assertNull(ev.getDisabledReason());
+ assertFalse(ev.isInvalid());
+ assertNull(ev.getInvalidityReason());
}
@Test
@@ -76,11 +76,11 @@ public class AbstractDomainEvent_veto_Test {
ev.veto(reason);
// then ... vetoes
- Assert.assertTrue(ev.isHidden());
- Assert.assertFalse(ev.isDisabled());
- Assert.assertNull(ev.getDisabledReason());
- Assert.assertFalse(ev.isInvalid());
- Assert.assertNull(ev.getInvalidityReason());
+ assertTrue(ev.isHidden());
+ assertFalse(ev.isDisabled());
+ assertNull(ev.getDisabledReason());
+ assertFalse(ev.isInvalid());
+ assertNull(ev.getInvalidityReason());
}
@Test
@@ -90,11 +90,9 @@ public class AbstractDomainEvent_veto_Test {
final AbstractDomainEvent<?> ev = new AbstractDomainEvent<Object>() { };
ev.setEventPhase(AbstractDomainEvent.Phase.DISABLE);
- // expect
- expectedException.expect(IllegalArgumentException.class);
-
// when
- ev.veto((String)null);
+ assertThrows(IllegalArgumentException.class, ()->
+ ev.veto((String)null));
}
@Test
@@ -107,11 +105,11 @@ public class AbstractDomainEvent_veto_Test {
ev.veto(reason);
// then
- Assert.assertFalse(ev.isHidden());
- Assert.assertTrue(ev.isDisabled());
- Assert.assertEquals(reason, ev.getDisabledReason());
- Assert.assertFalse(ev.isInvalid());
- Assert.assertNull(ev.getInvalidityReason());
+ assertFalse(ev.isHidden());
+ assertTrue(ev.isDisabled());
+ assertEquals(reason, ev.getDisabledReason());
+ assertFalse(ev.isInvalid());
+ assertNull(ev.getInvalidityReason());
}
@Test
@@ -124,11 +122,11 @@ public class AbstractDomainEvent_veto_Test {
ev.veto(reason);
// then
- Assert.assertFalse(ev.isHidden());
- Assert.assertTrue(ev.isDisabled());
- Assert.assertEquals(reason, ev.getDisabledReasonTranslatable());
- Assert.assertFalse(ev.isInvalid());
- Assert.assertNull(ev.getInvalidityReason());
+ assertFalse(ev.isHidden());
+ assertTrue(ev.isDisabled());
+ assertEquals(reason, ev.getDisabledReasonTranslatable());
+ assertFalse(ev.isInvalid());
+ assertNull(ev.getInvalidityReason());
}
@Test
@@ -137,11 +135,9 @@ public class AbstractDomainEvent_veto_Test {
// given
ev.setEventPhase(AbstractDomainEvent.Phase.VALIDATE);
- // expect
- expectedException.expect(IllegalArgumentException.class);
-
// when
- ev.veto((String)null);
+ assertThrows(IllegalArgumentException.class, ()->
+ ev.veto((String)null));
}
@Test
@@ -155,11 +151,11 @@ public class AbstractDomainEvent_veto_Test {
ev.veto(reason);
// then
- Assert.assertFalse(ev.isHidden());
- Assert.assertFalse(ev.isDisabled());
- Assert.assertNull(ev.getDisabledReason());
- Assert.assertTrue(ev.isInvalid());
- Assert.assertEquals(reason, ev.getInvalidityReason());
+ assertFalse(ev.isHidden());
+ assertFalse(ev.isDisabled());
+ assertNull(ev.getDisabledReason());
+ assertTrue(ev.isInvalid());
+ assertEquals(reason, ev.getInvalidityReason());
}
@Test
@@ -173,11 +169,11 @@ public class AbstractDomainEvent_veto_Test {
ev.veto(reason);
// then
- Assert.assertFalse(ev.isHidden());
- Assert.assertFalse(ev.isDisabled());
- Assert.assertNull(ev.getDisabledReason());
- Assert.assertTrue(ev.isInvalid());
- Assert.assertEquals(reason, ev.getInvalidityReasonTranslatable());
+ assertFalse(ev.isHidden());
+ assertFalse(ev.isDisabled());
+ assertNull(ev.getDisabledReason());
+ assertTrue(ev.isInvalid());
+ assertEquals(reason, ev.getInvalidityReasonTranslatable());
}
}
\ No newline at end of file
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerForTypeTest.java b/api/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerForTypeTest.java
index c779375c10..0f1f2c794a 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerForTypeTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerForTypeTest.java
@@ -21,7 +21,7 @@ package org.apache.isis.applib.services.exceprecog;
import java.util.Optional;
import java.util.function.Function;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java b/api/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java
index 88b03afdf3..d2288e6d74 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/services/exceprecog/ExceptionRecognizerGeneralTest.java
@@ -21,12 +21,12 @@ package org.apache.isis.applib.services.exceprecog;
import java.util.Optional;
import java.util.function.Predicate;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-public class ExceptionRecognizerGeneralTest {
+class ExceptionRecognizerGeneralTest {
private ExceptionRecognizer ersGeneral;
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/i18n/TranslatableStringTest.java b/api/applib/src/test/java/org/apache/isis/applib/services/i18n/TranslatableStringTest.java
index 30455602f6..860004e839 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/i18n/TranslatableStringTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/services/i18n/TranslatableStringTest.java
@@ -18,17 +18,16 @@
*/
package org.apache.isis.applib.services.i18n;
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.jmock.integration.junit4.JUnitRuleMockery;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-
-public class TranslatableStringTest {
+class TranslatableStringTest {
public static class GetText extends TranslatableStringTest {
@@ -76,13 +75,10 @@ public class TranslatableStringTest {
}
}
+ @ExtendWith(MockitoExtension.class)
public static class Translate extends TranslatableStringTest {
- @Rule
- public final JUnitRuleMockery context = new JUnitRuleMockery();
-
- @Mock
- private TranslationService mockTranslationService;
+ @Mock TranslationService mockTranslationService;
@Test
public void singularForm() throws Exception {
@@ -94,10 +90,8 @@ public class TranslatableStringTest {
final TranslatableString ts = TranslatableString.tr(simpleText);
// expect
- context.checking(new Expectations() {{
- oneOf(mockTranslationService).translate(someContext, simpleText);
- will(returnValue(translation));
- }});
+ Mockito.when(mockTranslationService.translate(someContext, simpleText))
+ .thenReturn(translation);
// when
assertThat(ts.translate(mockTranslationService, someContext), is(translation));
@@ -115,10 +109,8 @@ public class TranslatableStringTest {
final TranslatableString ts = TranslatableString.trn(singularText, pluralText, 1);
// expect
- context.checking(new Expectations() {{
- oneOf(mockTranslationService).translate(someContext, singularText, pluralText, 1);
- will(returnValue(translation));
- }});
+ Mockito.when(mockTranslationService.translate(someContext, singularText, pluralText, 1))
+ .thenReturn(translation);
// when
assertThat(ts.translate(mockTranslationService, someContext), is(translation));
@@ -137,10 +129,8 @@ public class TranslatableStringTest {
final TranslatableString ts = TranslatableString.trn(singularText, pluralText, number);
// expect
- context.checking(new Expectations() {{
- oneOf(mockTranslationService).translate(someContext, singularText, pluralText, number);
- will(returnValue(translation));
- }});
+ Mockito.when(mockTranslationService.translate(someContext, singularText, pluralText, number))
+ .thenReturn(translation);
// when
assertThat(ts.translate(mockTranslationService, someContext), is(translation));
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/metamodel/MetaModelService_Config_Test.java b/api/applib/src/test/java/org/apache/isis/applib/services/metamodel/MetaModelService_Config_Test.java
index 83c84abb5c..9128030db6 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/metamodel/MetaModelService_Config_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/services/metamodel/MetaModelService_Config_Test.java
@@ -18,16 +18,16 @@
*/
package org.apache.isis.applib.services.metamodel;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.emptyCollectionOf;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-public class MetaModelService_Config_Test {
+class MetaModelService_Config_Test {
@Test
public void namespace_prefixes() throws Exception {
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/queryresultscache/QueryResultsCache_KeyTest.java b/api/applib/src/test/java/org/apache/isis/applib/services/queryresultscache/QueryResultsCache_KeyTest.java
index a68154a597..4a1550062b 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/queryresultscache/QueryResultsCache_KeyTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/services/queryresultscache/QueryResultsCache_KeyTest.java
@@ -1,36 +1,40 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.isis.applib.services.queryresultscache;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-public class QueryResultsCache_KeyTest {
+class QueryResultsCache_KeyTest {
private QueryResultsCache.Key cacheKey;
static class A {}
+
@Test
public void toStringIs() {
cacheKey = new QueryResultsCache.Key(A.class, "foo", "key1", 2, 3, "key4");
- assertThat(cacheKey.toString(), is("org.apache.isis.applib.services.queryresultscache.QueryResultsCache_KeyTest$A#foo[key1, 2, 3, key4]"));
+ assertThat(cacheKey.toString(),
+ is("org.apache.isis.applib.services.queryresultscache.QueryResultsCache_KeyTest$A#foo[key1, 2, 3, key4]"));
}
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/wrapper/control/AsyncControl_Test.java b/api/applib/src/test/java/org/apache/isis/applib/services/wrapper/control/AsyncControl_Test.java
index 71acfc0fdc..4cf0a78e00 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/wrapper/control/AsyncControl_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/services/wrapper/control/AsyncControl_Test.java
@@ -18,11 +18,10 @@
*/
package org.apache.isis.applib.services.wrapper.control;
-import java.util.concurrent.Executor;
import java.util.stream.Collectors;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.springframework.core.task.support.ExecutorServiceAdapter;
import org.springframework.core.task.support.TaskExecutorAdapter;
@@ -30,7 +29,7 @@ import org.apache.isis.applib.services.user.UserMemento;
import lombok.val;
-public class AsyncControl_Test {
+class AsyncControl_Test {
@Test
public void defaults() throws Exception {
@@ -97,10 +96,7 @@ public class AsyncControl_Test {
@Test
public void chaining() throws Exception {
- val executorService = new ExecutorServiceAdapter(new TaskExecutorAdapter(new Executor() {
- @Override
- public void execute(Runnable command) {
- }
+ val executorService = new ExecutorServiceAdapter(new TaskExecutorAdapter(command -> {
}));
ExceptionHandler exceptionHandler = ex -> null;
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/wrapper/control/SyncControl_Test.java b/api/applib/src/test/java/org/apache/isis/applib/services/wrapper/control/SyncControl_Test.java
index fbeab313ae..4c656c73c1 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/wrapper/control/SyncControl_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/services/wrapper/control/SyncControl_Test.java
@@ -18,14 +18,15 @@
*/
package org.apache.isis.applib.services.wrapper.control;
-import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.*;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.apache.isis.commons.internal.base._NullSafe;
import lombok.val;
-public class SyncControl_Test {
+class SyncControl_Test {
@Test
public void defaults() throws Exception {
@@ -34,7 +35,7 @@ public class SyncControl_Test {
val control = SyncControl.control();
// then
- Assertions.assertThat(control.getExecutionModes()).isEmpty();
+ assertTrue(_NullSafe.isEmpty(control.getExecutionModes()));
}
@Test
@@ -46,7 +47,7 @@ public class SyncControl_Test {
control.withCheckRules();
// then
- Assertions.assertThat(control.getExecutionModes()).isEmpty();
+ assertTrue(_NullSafe.isEmpty(control.getExecutionModes()));
}
@Test
@@ -59,7 +60,7 @@ public class SyncControl_Test {
control.withSkipRules();
// then
- Assertions.assertThat(control.getExecutionModes()).contains(ExecutionMode.SKIP_RULE_VALIDATION);
+ assertTrue(control.getExecutionModes().contains(ExecutionMode.SKIP_RULE_VALIDATION));
}
@Test
@@ -72,7 +73,7 @@ public class SyncControl_Test {
control.withExecute();
// then
- Assertions.assertThat(control.getExecutionModes()).isEmpty();
+ assertTrue(_NullSafe.isEmpty(control.getExecutionModes()));
}
@Test
@@ -85,7 +86,7 @@ public class SyncControl_Test {
control.withNoExecute();
// then
- Assertions.assertThat(control.getExecutionModes()).contains(ExecutionMode.SKIP_EXECUTION);
+ assertTrue(control.getExecutionModes().contains(ExecutionMode.SKIP_EXECUTION));
}
@Test
@@ -98,10 +99,9 @@ public class SyncControl_Test {
.withSkipRules()
.with(exceptionHandler);
- Assertions.assertThat(
- control
- .getExecutionModes())
- .containsExactlyInAnyOrder(ExecutionMode.SKIP_RULE_VALIDATION, ExecutionMode.SKIP_EXECUTION);
+ assertTrue(control.getExecutionModes().size()==2);
+ assertTrue(control.getExecutionModes().contains(ExecutionMode.SKIP_RULE_VALIDATION));
+ assertTrue(control.getExecutionModes().contains(ExecutionMode.SKIP_EXECUTION));
}
}
\ No newline at end of file
diff --git a/api/applib/src/test/java/org/apache/isis/applib/spec/AbstractSpecification2Test.java b/api/applib/src/test/java/org/apache/isis/applib/spec/AbstractSpecification2Test.java
index fe221feab3..e9184c7fb8 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/spec/AbstractSpecification2Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/spec/AbstractSpecification2Test.java
@@ -18,7 +18,7 @@
*/
package org.apache.isis.applib.spec;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
@@ -29,7 +29,7 @@ import org.apache.isis.applib.services.i18n.TranslatableString;
import org.apache.isis.applib.spec.AbstractSpecification2.Nullability;
import org.apache.isis.applib.spec.AbstractSpecification2.TypeChecking;
-public class AbstractSpecification2Test {
+class AbstractSpecification2Test {
private AbstractSpecification2<String> specAbstractSomeDomainObject;
diff --git a/api/applib/src/test/java/org/apache/isis/applib/spec/AbstractSpecificationTest.java b/api/applib/src/test/java/org/apache/isis/applib/spec/AbstractSpecificationTest.java
index af32e0d237..5c131bcdd9 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/spec/AbstractSpecificationTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/spec/AbstractSpecificationTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.isis.applib.spec;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
@@ -28,7 +28,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.isis.applib.spec.AbstractSpecification.Nullability;
import org.apache.isis.applib.spec.AbstractSpecification.TypeChecking;
-public class AbstractSpecificationTest {
+class AbstractSpecificationTest {
private static class SomeDomainObject {
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/EnumsTest.java b/api/applib/src/test/java/org/apache/isis/applib/util/EnumsTest.java
index 50c4c203fb..b56bf09b0d 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/EnumsTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/EnumsTest.java
@@ -18,14 +18,14 @@
*/
package org.apache.isis.applib.util;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.isis.applib.annotation.Where;
-public class EnumsTest {
+class EnumsTest {
@Test
public void getFriendlyNameOf() {
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/EnumsTest_converts.java b/api/applib/src/test/java/org/apache/isis/applib/util/EnumsTest_converts.java
index 38ca5325a3..8e15067b20 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/EnumsTest_converts.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/EnumsTest_converts.java
@@ -18,12 +18,12 @@
*/
package org.apache.isis.applib.util;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-public class EnumsTest_converts {
+class EnumsTest_converts {
private static enum MyEnum {
CONTENT_TYPE, LAST_MODIFIED, WARNING, X_REPRESENTATION_TYPE, OBJECT_ACTION
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/Invoice.java b/api/applib/src/test/java/org/apache/isis/applib/util/Invoice.java
index dfd7900cee..971d3257ad 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/Invoice.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/Invoice.java
@@ -1,18 +1,20 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.isis.applib.util;
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/InvoiceItem.java b/api/applib/src/test/java/org/apache/isis/applib/util/InvoiceItem.java
index 8c79a0ea0a..4e4f84ea0a 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/InvoiceItem.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/InvoiceItem.java
@@ -1,18 +1,20 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.isis.applib.util;
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/Numbered.java b/api/applib/src/test/java/org/apache/isis/applib/util/Numbered.java
index e6d925c988..0d2d5ec74a 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/Numbered.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/Numbered.java
@@ -1,18 +1,20 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.isis.applib.util;
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/NumberedEvaluator.java b/api/applib/src/test/java/org/apache/isis/applib/util/NumberedEvaluator.java
index 51a550c8ef..ced65bd6ed 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/NumberedEvaluator.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/NumberedEvaluator.java
@@ -1,18 +1,20 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.isis.applib.util;
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_compareTo.java b/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_compareTo.java
index 14b0f0cc37..3a0916fc81 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_compareTo.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_compareTo.java
@@ -1,34 +1,35 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.isis.applib.util;
import java.util.List;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
import org.apache.isis.core.internaltestsupport.contract.ComparableContractTest_compareTo;
-
-public class ObjectContractsTest_compareTo extends ComparableContractTest_compareTo<InvoiceItem> {
+class ObjectContractsTest_compareTo extends ComparableContractTest_compareTo<InvoiceItem> {
private Invoice inv123;
private Invoice inv456;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
inv123 = new Invoice();
inv123.setNumber("123");
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals.java b/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals.java
index fa6550620d..3cc15594cd 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals.java
@@ -1,35 +1,35 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.isis.applib.util;
-import java.util.Comparator;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@SuppressWarnings("deprecation")
-public class ObjectContractsTest_equals {
+class ObjectContractsTest_equals {
static class Invoice4 {
private static final String KEY_PROPERTIES = "number";
@@ -38,7 +38,7 @@ public class ObjectContractsTest_equals {
public String getNumber() {
return number;
}
- public void setNumber(String number) {
+ public void setNumber(final String number) {
this.number = number;
}
@Override
@@ -46,7 +46,7 @@ public class ObjectContractsTest_equals {
return ObjectContracts.hashCode(this, KEY_PROPERTIES);
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
return ObjectContracts.equals(this, obj, KEY_PROPERTIES);
}
@@ -57,7 +57,7 @@ public class ObjectContractsTest_equals {
private Invoice4 r;
private String x;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
p = new Invoice4();
p.setNumber("123");
@@ -107,7 +107,7 @@ public class ObjectContractsTest_equals {
@Override
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
return contract.equals(this, o);
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals_and_hashCode.java b/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals_and_hashCode.java
index a8120070f3..dbce9e440b 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals_and_hashCode.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals_and_hashCode.java
@@ -1,35 +1,37 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.isis.applib.util;
import java.util.List;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
import org.apache.isis.commons.internal.collections._Lists;
import org.apache.isis.core.internaltestsupport.contract.ValueTypeContractTestAbstract;
-public class ObjectContractsTest_equals_and_hashCode extends ValueTypeContractTestAbstract<InvoiceItem3> {
+class ObjectContractsTest_equals_and_hashCode extends ValueTypeContractTestAbstract<InvoiceItem3> {
private Invoice3 inv123;
private Invoice3 inv456;
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
inv123 = new Invoice3();
inv123.setNumber("123");
@@ -66,7 +68,7 @@ class Invoice3 {
public String getNumber() {
return number;
}
- public void setNumber(String number) {
+ public void setNumber(final String number) {
this.number = number;
}
@Override
@@ -74,7 +76,7 @@ class Invoice3 {
return ObjectContracts.hashCode(this, KEY_PROPERTIES);
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
return ObjectContracts.equals(this, obj, KEY_PROPERTIES);
}
@@ -83,7 +85,7 @@ class Invoice3 {
@SuppressWarnings("deprecation")
class InvoiceItem3 {
- static InvoiceItem3 newInvoiceItem(Invoice3 invoice, String productCode, Integer quantity) {
+ static InvoiceItem3 newInvoiceItem(final Invoice3 invoice, final String productCode, final Integer quantity) {
final InvoiceItem3 invoiceItem = new InvoiceItem3();
invoiceItem.setInvoice(invoice);
invoiceItem.setProductCode(productCode);
@@ -95,7 +97,7 @@ class InvoiceItem3 {
public Invoice3 getInvoice() {
return invoice;
}
- public void setInvoice(Invoice3 invoice) {
+ public void setInvoice(final Invoice3 invoice) {
this.invoice = invoice;
}
@@ -103,7 +105,7 @@ class InvoiceItem3 {
public String getProductCode() {
return productCode;
}
- public void setProductCode(String productCode) {
+ public void setProductCode(final String productCode) {
this.productCode = productCode;
}
@@ -111,7 +113,7 @@ class InvoiceItem3 {
public Integer getQuantity() {
return quantity;
}
- public void setQuantity(Integer quantity) {
+ public void setQuantity(final Integer quantity) {
this.quantity = quantity;
}
@@ -122,7 +124,7 @@ class InvoiceItem3 {
return ObjectContracts.hashCode(this, KEY_PROPERTIES);
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
return ObjectContracts.equals(this, obj, KEY_PROPERTIES);
}
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_toString.java b/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_toString.java
index bc050f6edf..9620622e49 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_toString.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_toString.java
@@ -1,23 +1,25 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.isis.applib.util;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@@ -30,7 +32,7 @@ public class ObjectContractsTest_toString {
private Invoice inv;
private Invoice2 inv2;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
inv = new Invoice();
inv2 = new Invoice2();
@@ -68,7 +70,7 @@ class Invoice2 implements Comparable<Invoice2>, Numbered {
public String getNumber() {
return number;
}
- public void setNumber(String number) {
+ public void setNumber(final String number) {
this.number = number;
}
@Override
@@ -76,7 +78,7 @@ class Invoice2 implements Comparable<Invoice2>, Numbered {
return ObjectContracts.toString(this, KEY_PROPERTIES);
}
@Override
- public int compareTo(Invoice2 o) {
+ public int compareTo(final Invoice2 o) {
return ObjectContracts.compare(this, o, KEY_PROPERTIES);
}
}
@@ -84,7 +86,7 @@ class Invoice2 implements Comparable<Invoice2>, Numbered {
@SuppressWarnings("deprecation")
class InvoiceItem2 implements Comparable<InvoiceItem2> {
- static InvoiceItem2 newInvoiceItem(Invoice2 invoice, String productCode, Integer quantity, Boolean rush) {
+ static InvoiceItem2 newInvoiceItem(final Invoice2 invoice, final String productCode, final Integer quantity, final Boolean rush) {
final InvoiceItem2 invoiceItem = new InvoiceItem2();
invoiceItem.setInvoice(invoice);
invoiceItem.setProductCode(productCode);
@@ -97,7 +99,7 @@ class InvoiceItem2 implements Comparable<InvoiceItem2> {
public Invoice2 getInvoice() {
return invoice;
}
- public void setInvoice(Invoice2 invoice) {
+ public void setInvoice(final Invoice2 invoice) {
this.invoice = invoice;
}
@@ -105,7 +107,7 @@ class InvoiceItem2 implements Comparable<InvoiceItem2> {
public String getProductCode() {
return productCode;
}
- public void setProductCode(String productCode) {
+ public void setProductCode(final String productCode) {
this.productCode = productCode;
}
@@ -113,7 +115,7 @@ class InvoiceItem2 implements Comparable<InvoiceItem2> {
public Integer getQuantity() {
return quantity;
}
- public void setQuantity(Integer quantity) {
+ public void setQuantity(final Integer quantity) {
this.quantity = quantity;
}
@@ -121,13 +123,13 @@ class InvoiceItem2 implements Comparable<InvoiceItem2> {
public Boolean isRush() {
return rush;
}
- public void setRush(Boolean rush) {
+ public void setRush(final Boolean rush) {
this.rush = rush;
}
private static final String KEY_PROPERTIES = "invoice desc, productCode, quantity, rush desc";
- private static final ObjectContract<InvoiceItem2> contract =
+ private static final ObjectContract<InvoiceItem2> contract =
ObjectContracts.parse(InvoiceItem2.class, KEY_PROPERTIES)
.withValueToStringFunction(ToStringEvaluator.combineToFunction(new NumberedEvaluator()));
@@ -138,7 +140,7 @@ class InvoiceItem2 implements Comparable<InvoiceItem2> {
//return new ObjectContracts().with(new NumberedEvaluator()).toStringOf(this, KEY_PROPERTIES);
}
@Override
- public int compareTo(InvoiceItem2 o) {
+ public int compareTo(final InvoiceItem2 o) {
return ObjectContracts.compare(this, o, KEY_PROPERTIES);
}
}
\ No newline at end of file
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/ReasonBufferTest.java b/api/applib/src/test/java/org/apache/isis/applib/util/ReasonBufferTest.java
index 336d9c6bd4..b62729ca58 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/ReasonBufferTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/ReasonBufferTest.java
@@ -18,15 +18,15 @@
*/
package org.apache.isis.applib.util;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-public class ReasonBufferTest {
+class ReasonBufferTest {
private ReasonBuffer reason;
- @Before
+ @BeforeEach
public void setUp() {
reason = new ReasonBuffer();
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/ReasonsTest.java b/api/applib/src/test/java/org/apache/isis/applib/util/ReasonsTest.java
index 2b060c4527..a84b3de37f 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/ReasonsTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/ReasonsTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.isis.applib.util;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-public class ReasonsTest {
+class ReasonsTest {
@Test
public void testNoReasonReturnsNull() throws Exception {
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/TitleBufferTest.java b/api/applib/src/test/java/org/apache/isis/applib/util/TitleBufferTest.java
index 4701f182ec..9f2d6cb89a 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/TitleBufferTest.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/TitleBufferTest.java
@@ -18,13 +18,13 @@
*/
package org.apache.isis.applib.util;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.fail;
-public class TitleBufferTest {
+class TitleBufferTest {
String companyName;
String name;
@@ -36,7 +36,7 @@ public class TitleBufferTest {
TitleBuffer t2;
TitleBuffer t3;
- @Before
+ @BeforeEach
public void setUp() {
name = "Fred";
t1 = new TitleBuffer(name);
@@ -53,17 +53,17 @@ public class TitleBufferTest {
@Test
public void testAppend() {
t1.append("");
- assertEquals("add empty string", name, t1.toString());
+ assertEquals(name, t1.toString(), "add empty string");
t1.append("Smith");
name += (" " + "Smith");
- assertEquals("append simple string", name, t1.toString());
+ assertEquals(name, t1.toString(), "append simple string");
t1.append(",", "");
- assertEquals("append empty string with delimiter", name, t1.toString());
+ assertEquals(name, t1.toString(), "append empty string with delimiter");
t1.append(",", null);
- assertEquals("append null with delimiter", name, t1.toString());
+ assertEquals(name, t1.toString(), "append null with delimiter");
t1.append(",", "Xyz Ltd.");
name += (", " + "Xyz Ltd.");
- assertEquals("append string with delimiter", name, t1.toString());
+ assertEquals(name, t1.toString(), "append string with delimiter");
}
@Test
@@ -182,11 +182,11 @@ public class TitleBufferTest {
final TitleTestObject s = new TitleTestObject();
t1.append(s);
- assertEquals("append empty TextString", name, t1.toString());
+ assertEquals(name, t1.toString(), "append empty TextString");
//
t1.append(new TitleTestObject("square"));
- assertEquals("append empty TextString", name + " " + "square", t1.toString());
+ assertEquals(name + " " + "square", t1.toString(), "append empty TextString");
}
@Test
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/schema/CommandDtoUtils_Test.java b/api/applib/src/test/java/org/apache/isis/applib/util/schema/CommandDtoUtils_Test.java
index d4e84c3de3..fbe374e7f2 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/schema/CommandDtoUtils_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/schema/CommandDtoUtils_Test.java
@@ -18,8 +18,8 @@
*/
package org.apache.isis.applib.util.schema;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -31,7 +31,7 @@ import org.apache.isis.schema.cmd.v2.MapDto;
public class CommandDtoUtils_Test {
CommandDto dto;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
dto = new CommandDto();
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/util/schema/InteractionDtoUtilsTest_deriveLogicalMemberId.java b/api/applib/src/test/java/org/apache/isis/applib/util/schema/InteractionDtoUtilsTest_deriveLogicalMemberId.java
index 195a144c9c..1490c45404 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/util/schema/InteractionDtoUtilsTest_deriveLogicalMemberId.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/util/schema/InteractionDtoUtilsTest_deriveLogicalMemberId.java
@@ -16,7 +16,7 @@
*/
package org.apache.isis.applib.util.schema;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
@@ -24,7 +24,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
import org.apache.isis.applib.services.bookmark.Bookmark;
-public class InteractionDtoUtilsTest_deriveLogicalMemberId {
+class InteractionDtoUtilsTest_deriveLogicalMemberId {
@Test
public void happy_case() throws Exception {
diff --git a/api/applib/src/test/java/org/apache/isis/applib/value/Blob_constructor_Test.java b/api/applib/src/test/java/org/apache/isis/applib/value/Blob_constructor_Test.java
index 7dbef22a89..b60ddf2af0 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/value/Blob_constructor_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/value/Blob_constructor_Test.java
@@ -18,18 +18,21 @@
*/
package org.apache.isis.applib.value;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class Blob_constructor_Test {
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class Blob_constructor_Test {
@Test
public void happyCase() throws Exception {
new Blob("validName", "application", "xml", new byte[]{0,1});
}
- @Test(expected=IllegalArgumentException.class)
+ @Test
public void name_cannotContainColon() throws Exception {
- new Blob("with a colon : in it", "application", "xml", new byte[]{0,1});
+ assertThrows(IllegalArgumentException.class, ()->
+ new Blob("with a colon : in it", "application", "xml", new byte[]{0,1}));
}
}
diff --git a/api/applib/src/test/java/org/apache/isis/applib/value/Clob_constructor_Test.java b/api/applib/src/test/java/org/apache/isis/applib/value/Clob_constructor_Test.java
index d0c7a40371..371cc163fc 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/value/Clob_constructor_Test.java
+++ b/api/applib/src/test/java/org/apache/isis/applib/value/Clob_constructor_Test.java
@@ -18,18 +18,21 @@
*/
package org.apache.isis.applib.value;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class Clob_constructor_Test {
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class Clob_constructor_Test {
@Test
public void happyCase() throws Exception {
new Clob("validName", "application", "xml", "abc");
}
- @Test(expected=IllegalArgumentException.class)
- public void name_cannotContainColon() throws Exception {
- new Clob("with a colon : in it", "application", "xml", "abc");
+ @Test
+ public void name_cannotContainColon() {
+ assertThrows(IllegalArgumentException.class, ()->
+ new Clob("with a colon : in it", "application", "xml", "abc"));
}
}
diff --git a/commons/src/main/java/org/apache/isis/commons/collections/ImmutableEnumSet.java b/commons/src/main/java/org/apache/isis/commons/collections/ImmutableEnumSet.java
index 7c60328603..0a6c4fb6f2 100644
--- a/commons/src/main/java/org/apache/isis/commons/collections/ImmutableEnumSet.java
+++ b/commons/src/main/java/org/apache/isis/commons/collections/ImmutableEnumSet.java
@@ -72,6 +72,10 @@ implements Iterable<E>, java.io.Serializable {
return from(EnumSet.allOf(enumType));
}
+ public int size() {
+ return delegate.size();
+ }
+
public boolean contains(final E element) {
return delegate.contains(element);
}
@@ -111,5 +115,4 @@ implements Iterable<E>, java.io.Serializable {
return from(newEnumSet);
}
-
}
diff --git a/commons/src/main/java/org/apache/isis/commons/internal/base/_NullSafe.java b/commons/src/main/java/org/apache/isis/commons/internal/base/_NullSafe.java
index 469c14ce21..37550f6a83 100644
--- a/commons/src/main/java/org/apache/isis/commons/internal/base/_NullSafe.java
+++ b/commons/src/main/java/org/apache/isis/commons/internal/base/_NullSafe.java
@@ -21,6 +21,7 @@ package org.apache.isis.commons.internal.base;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Collections;
+import java.util.EnumSet;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;
@@ -35,6 +36,7 @@ import java.util.stream.StreamSupport;
import org.springframework.lang.Nullable;
import org.apache.isis.commons.collections.Can;
+import org.apache.isis.commons.collections.ImmutableEnumSet;
/**
* <h1>- internal use only -</h1>
@@ -286,6 +288,8 @@ public final class _NullSafe {
public static boolean isEmpty(final @Nullable long[] array){ return array==null || array.length == 0;}
public static boolean isEmpty(final @Nullable short[] array){ return array==null || array.length == 0;}
public static <T> boolean isEmpty(final @Nullable T[] array){ return array==null || array.length == 0;}
+ public static boolean isEmpty(final @Nullable EnumSet<?> enumSet){ return enumSet==null || enumSet.size() == 0;}
+ public static boolean isEmpty(final @Nullable ImmutableEnumSet<?> enumSet){ return enumSet==null || enumSet.size() == 0;}
// -- SIZE/LENGTH CHECKS
@@ -301,6 +305,8 @@ public final class _NullSafe {
public static int size(final @Nullable long[] array){ return array!=null ? array.length : 0; }
public static int size(final @Nullable short[] array){ return array!=null ? array.length : 0; }
public static <T> int size(final @Nullable T[] array){ return array!=null ? array.length : 0; }
+ public static int size(final @Nullable EnumSet<?> enumSet){ return enumSet!=null ? enumSet.size() : 0; }
+ public static int size(final @Nullable ImmutableEnumSet<?> enumSet){ return enumSet!=null ? enumSet.size() : 0; }
// -- TO STRING