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 2020/01/30 14:24:40 UTC
[isis] branch master updated: ISIS-2223: integrate jacoco with
surefire
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 5caed74 ISIS-2223: integrate jacoco with surefire
5caed74 is described below
commit 5caed7435e077d24f48725b9a08f565a36cd6208
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Jan 30 15:24:31 2020 +0100
ISIS-2223: integrate jacoco with surefire
- that is allow jacoco to modify the argLine as passed over to surefire
https://stackoverflow.com/questions/46489455/append-the-value-of-argline-param-in-maven-surefire-plugin/46490011
---
.../commons/internal/reflection/ReflectTest.java | 73 ++++++++++++----------
core/pom.xml | 2 +-
2 files changed, 42 insertions(+), 33 deletions(-)
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/commons/internal/reflection/ReflectTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/commons/internal/reflection/ReflectTest.java
index cfadb66..2f4d6e0 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/commons/internal/reflection/ReflectTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/commons/internal/reflection/ReflectTest.java
@@ -22,17 +22,19 @@ package org.apache.isis.core.metamodel.commons.internal.reflection;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
import javax.xml.bind.JAXBContext;
import org.junit.jupiter.api.Test;
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.services.jaxb.JaxbServiceDefault;
+import org.apache.isis.core.commons.internal.collections._Sets;
import org.apache.isis.core.commons.internal.reflection._Reflect.InterfacePolicy;
import org.apache.isis.core.metamodel.services.user.UserServiceDefault;
@@ -40,6 +42,8 @@ import static org.apache.isis.core.commons.internal.reflection._Reflect.getAnnot
import static org.apache.isis.core.commons.internal.reflection._Reflect.streamAllMethods;
import static org.apache.isis.core.commons.internal.reflection._Reflect.streamTypeHierarchy;
+import lombok.val;
+
//TODO we are using real world classes from the framework, we could instead isolate these tests
// if we provide some custom classes for hierarchy traversal here (could be nested);
// then move this test to the 'commons' module, where it belongs
@@ -50,31 +54,32 @@ class ReflectTest {
Class<?> type = UserServiceDefault.SudoServiceSpi.class;
- String typeListLiteral = streamTypeHierarchy(type, InterfacePolicy.EXCLUDE)
+ val typeSet = streamTypeHierarchy(type, InterfacePolicy.EXCLUDE)
.map(Class::getName)
- .collect(Collectors.joining(",\n"));
+ .collect(Collectors.toSet());
- assertEquals(""
- + "org.apache.isis.core.metamodel.services.user.UserServiceDefault$SudoServiceSpi,\n"
- + "java.lang.Object",
- typeListLiteral);
+ assertSetContainsAll(_Sets.<String>of(
+ "org.apache.isis.core.metamodel.services.user.UserServiceDefault$SudoServiceSpi",
+ "java.lang.Object"),
+ typeSet);
}
+
@Test
void typeHierarchyAndInterfaces() {
Class<?> type = UserServiceDefault.SudoServiceSpi.class;
- String typeListLiteral = streamTypeHierarchy(type, InterfacePolicy.INCLUDE)
+ val typeSet = streamTypeHierarchy(type, InterfacePolicy.INCLUDE)
.map(Class::getName)
- .collect(Collectors.joining(",\n"));
+ .collect(Collectors.toSet());
- assertEquals(
- "org.apache.isis.core.metamodel.services.user.UserServiceDefault$SudoServiceSpi,\n"
- + "org.apache.isis.applib.services.sudo.SudoService$Spi,\n"
- + "java.lang.Object",
- typeListLiteral);
+ assertSetContainsAll(_Sets.<String>of(
+ "org.apache.isis.core.metamodel.services.user.UserServiceDefault$SudoServiceSpi",
+ "org.apache.isis.applib.services.sudo.SudoService$Spi",
+ "java.lang.Object"),
+ typeSet);
}
@@ -83,18 +88,16 @@ class ReflectTest {
Class<?> type = UserServiceDefault.SudoServiceSpi.class;
- String typeListLiteral = streamAllMethods(type, true)
+ val typeSet = streamAllMethods(type, true)
.map(m->m.toString())
- .sorted()
- .collect(Collectors.joining(",\n"));
+ .collect(Collectors.toSet());
- assertEquals(""
- + "public abstract void org.apache.isis.applib.services.sudo.SudoService$Spi.releaseRunAs(),\n"
- + "public abstract void org.apache.isis.applib.services.sudo.SudoService$Spi.runAs(java.lang.String,java.util.List),\n"
- + "public void org.apache.isis.core.metamodel.services.user.UserServiceDefault$SudoServiceSpi.releaseRunAs(),\n"
- + "public void org.apache.isis.core.metamodel.services.user.UserServiceDefault$SudoServiceSpi.runAs(java.lang.String,java.util.List)"
- ,
- typeListLiteral);
+ assertSetContainsAll(_Sets.<String>of(
+ "public abstract void org.apache.isis.applib.services.sudo.SudoService$Spi.releaseRunAs()",
+ "public abstract void org.apache.isis.applib.services.sudo.SudoService$Spi.runAs(java.lang.String,java.util.List)",
+ "public void org.apache.isis.core.metamodel.services.user.UserServiceDefault$SudoServiceSpi.releaseRunAs()",
+ "public void org.apache.isis.core.metamodel.services.user.UserServiceDefault$SudoServiceSpi.runAs(java.lang.String,java.util.List)"),
+ typeSet);
}
@@ -114,16 +117,16 @@ class ReflectTest {
Class<?> type = JaxbServiceDefault.class;
- String typeListLiteral = streamTypeHierarchy(type, InterfacePolicy.INCLUDE)
+ val typeSet = streamTypeHierarchy(type, InterfacePolicy.INCLUDE)
.map(t->t.getName())
- .collect(Collectors.joining(",\n"));
+ .collect(Collectors.toSet());
- assertEquals(
- "org.apache.isis.applib.services.jaxb.JaxbServiceDefault,\n"
- + "org.apache.isis.applib.services.jaxb.JaxbService$Simple,\n"
- + "org.apache.isis.applib.services.jaxb.JaxbService,\n"
- + "java.lang.Object",
- typeListLiteral);
+ assertSetContainsAll(_Sets.<String>of(
+ "org.apache.isis.applib.services.jaxb.JaxbServiceDefault",
+ "org.apache.isis.applib.services.jaxb.JaxbService$Simple",
+ "org.apache.isis.applib.services.jaxb.JaxbService",
+ "java.lang.Object"),
+ typeSet);
}
@@ -139,5 +142,11 @@ class ReflectTest {
assertNotNull(annot);
}
+
+ // -- HELPER
+
+ private static void assertSetContainsAll(Set<String> shouldContain, Set<String> actuallyContains) {
+ assertTrue(_Sets.minus(shouldContain, actuallyContains).isEmpty());
+ }
}
diff --git a/core/pom.xml b/core/pom.xml
index edb1d1b..a5db4dd 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -320,7 +320,7 @@
<exclude>${testsToExclude}</exclude>
</excludes>
<printSummary>false</printSummary>
- <argLine>${surefire-plugin.argLine}</argLine>
+ <argLine>@{argLine} ${surefire-plugin.argLine}</argLine>
</configuration>
<!-- goal:test binds to phase:test -->
</plugin>