diff --git a/.travis.yml b/.travis.yml
index 21da563d6..1437875bb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,7 +18,7 @@ before_install:
- mkdir -p $HOME/.script
- curl https://report.ci/annotate.py -o $HOME/.script/annotate.py --retry 5
- curl https://report.ci/upload.py -o $HOME/.script/upload.py --retry 5
- - curl https://codecov.io/bash -o $HOME/.script/codecov.bash --retry 5
+ - curl https://codecov.io/bash -o $HOME/.script/codecov.bash --retry 5 -k
- chmod +x $HOME/.script/codecov.bash
- chmod +x .travisci/*.sh
install:
diff --git a/pom.xml b/pom.xml
index d367862e7..ecf731f4e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -327,6 +327,7 @@
org.hamcrest:hamcrest:2.2:jarorg.hamcrest:hamcrest:2.1:jar
+ ch.powerunit.extensions:powerunit-extensions-matchers:0.2.0:jartruech.powerunit.extensions.matchers
diff --git a/src/it/multimodule-nogeneric-it-jdk8/children/pom.xml b/src/it/multimodule-nogeneric-it-jdk8/children/pom.xml
index 494834704..585edeb2f 100644
--- a/src/it/multimodule-nogeneric-it-jdk8/children/pom.xml
+++ b/src/it/multimodule-nogeneric-it-jdk8/children/pom.xml
@@ -69,5 +69,10 @@
powerunit-extensions-matchers-multimodule-parent-it1000${project.version}
+
+ ch.powerunit.extensions
+ powerunit-extensions-matchers-multimodule-parent-old-it1000
+ ${project.version}
+
\ No newline at end of file
diff --git a/src/it/multimodule-nogeneric-it-jdk8/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo24.java b/src/it/multimodule-nogeneric-it-jdk8/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo24.java
new file mode 100644
index 000000000..8fa4c8819
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk8/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo24.java
@@ -0,0 +1,51 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.children;
+
+import ch.powerunit.extensions.matchers.ProvideMatchers;
+import ch.powerunit.extensions.matchers.multi.parentold.Pojo1;
+
+/**
+ * @author borettim
+ *
+ */
+@ProvideMatchers
+public class Pojo24 extends Pojo1 {
+
+ public String msg2;
+
+ public Pojo24() {
+ }
+
+ public Pojo24(String msg2) {
+ this.msg2 = msg2;
+ }
+
+ public Pojo24(String msg1, String msg2) {
+ super(msg1);
+ this.msg2 = msg2;
+ }
+
+ @Override
+ public String toString() {
+ return "Pojo24 [msg2=" + msg2 + ", msg1=" + msg1 + "]";
+ }
+
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk8/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo26.java b/src/it/multimodule-nogeneric-it-jdk8/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo26.java
new file mode 100644
index 000000000..b35b7d79d
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk8/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo26.java
@@ -0,0 +1,47 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.children;
+
+import ch.powerunit.extensions.matchers.ProvideMatchers;
+import ch.powerunit.extensions.matchers.multi.parentold.Pojo1;
+
+/**
+ * @author borettim
+ *
+ */
+@ProvideMatchers
+public class Pojo26 {
+
+ public Pojo1 field1;
+
+ public Pojo26() {
+ }
+
+ public Pojo26(Pojo1 field1) {
+ super();
+ this.field1 = field1;
+ }
+
+ @Override
+ public String toString() {
+ return "Pojo26 [field1=" + field1 + "]";
+ }
+
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo24MatcherTest.java b/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo24MatcherTest.java
new file mode 100644
index 000000000..5d245333a
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo24MatcherTest.java
@@ -0,0 +1,96 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.children;
+
+import ch.powerunit.TestDelegate;
+import ch.powerunit.TestSuite;
+import ch.powerunit.extensions.matchers.multi.parentold.Pojo1Matchers;
+import ch.powerunit.matchers.MatcherTester;
+import static ch.powerunit.matchers.MatcherTester.matcher;
+import static ch.powerunit.matchers.MatcherTester.value;
+
+public class Pojo24MatcherTest implements TestSuite {
+
+ //@formatter:off
+ @TestDelegate
+ public final MatcherTester> tester = testerOfMatcher(Pojo24Matchers.Pojo24MatcherImpl.class)
+ .with(
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24With().msg2ContainsString("12"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent ANYTHING]\n[msg2 a string containing \"12\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("12"),
+ new Pojo24("121"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[msg2 was \"11\"]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24With(Pojo1Matchers.pojo1With().msg1("x")).msg2ContainsString("12"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is \"x\"]\n]\n[msg2 a string containing \"12\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("x","12"),
+ new Pojo24("x","121"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[parent [msg1 was null]\n]\n[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[parent [msg1 was null]\n]\n[msg2 was \"11\"]\n"),
+ value(new Pojo24("z","11")).withMessage("[parent [msg1 was \"z\"]\n]\n[msg2 was \"11\"]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24WithSameValue(new Pojo24("x")))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is null]\n]\n[msg2 is \"x\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("x"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[msg2 was \"11\"]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24WithSameValue(new Pojo24("y","x")))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is \"y\"]\n]\n[msg2 is \"x\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("y","x"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[parent [msg1 was null]\n]\n[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[parent [msg1 was null]\n]\n[msg2 was \"11\"]\n"),
+ value(new Pojo24("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24WithSameValue(new Pojo24("y","x"),"msg2"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is \"y\"]\n]\n[msg2 ANYTHING]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("y","x"),
+ new Pojo24("y","x2"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[parent [msg1 was null]\n]\n"),
+ value(new Pojo24("11")).withMessage("[parent [msg1 was null]\n]\n"),
+ value(new Pojo24("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24WithSameValue(new Pojo24("y","x"),"msg1"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is \"y\"]\n]\n[msg2 is \"x\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("y","x"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[parent [msg1 was null]\n]\n[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[parent [msg1 was null]\n]\n[msg2 was \"11\"]\n")));
+ //@formatter:on
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo4MatcherTest.java b/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo4MatcherTest.java
index e7be3d89a..d24a8b8f9 100644
--- a/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo4MatcherTest.java
+++ b/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo4MatcherTest.java
@@ -71,6 +71,27 @@ public class Pojo4MatcherTest implements TestSuite {
value("").withMessage("was \"\""),
value(new Pojo4()).withMessage("[parent [msg1 was null]\n]\n[msg2 was null]\n"),
value(new Pojo4("11")).withMessage("[parent [msg1 was null]\n]\n[msg2 was \"11\"]\n"),
- value(new Pojo4("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")));
+ value(new Pojo4("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")),
+ matcher((Pojo4Matchers.Pojo4MatcherImpl) Pojo4Matchers.pojo4WithSameValue(new Pojo4("y","x"),"msg2"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo4 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parent.Pojo1 with\n[msg1 is \"y\"]\n]\n[msg2 ANYTHING]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo4("y","x"),
+ new Pojo4("y","x2"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo4()).withMessage("[parent [msg1 was null]\n]\n"),
+ value(new Pojo4("11")).withMessage("[parent [msg1 was null]\n]\n"),
+ value(new Pojo4("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")),
+ matcher((Pojo4Matchers.Pojo4MatcherImpl) Pojo4Matchers.pojo4WithSameValue(new Pojo4("y","x"),"msg1"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo4 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parent.Pojo1 with\n[msg1 ANYTHING]\n]\n[msg2 is \"x\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo4("y","x"),
+ new Pojo4("y2","x"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo4()).withMessage("[msg2 was null]\n"),
+ value(new Pojo4("11")).withMessage("[msg2 was \"11\"]\n")));
//@formatter:on
}
diff --git a/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo6MatcherTest.java b/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo6MatcherTest.java
index 184a82155..636372f66 100644
--- a/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo6MatcherTest.java
+++ b/src/it/multimodule-nogeneric-it-jdk8/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo6MatcherTest.java
@@ -70,6 +70,15 @@ public class Pojo6MatcherTest implements TestSuite {
value("").withMessage("was \"\""),
value(new Pojo6()).withMessage("[field1 was null]\n"),
value(new Pojo6(new Pojo1())).withMessage("[field1 [msg1 was null]\n]\n"),
- value(new Pojo6(new Pojo1("t"))).withMessage("[field1 [msg1 was \"t\"]\n]\n")));
+ value(new Pojo6(new Pojo1("t"))).withMessage("[field1 [msg1 was \"t\"]\n]\n")),
+ matcher((Pojo6Matchers.Pojo6MatcherImpl) Pojo6Matchers.pojo6WithSameValue(new Pojo6(new Pojo1("a")),"field1.msg1"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo6 with\n[field1 an instance of ch.powerunit.extensions.matchers.multi.parent.Pojo1 with\n[msg1 ANYTHING]\n]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo6(new Pojo1("a")),
+ new Pojo6(new Pojo1("b")))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo6()).withMessage("[field1 was null]\n")));
//@formatter:on
}
diff --git a/src/it/multimodule-nogeneric-it-jdk8/parent-old/pom.xml b/src/it/multimodule-nogeneric-it-jdk8/parent-old/pom.xml
new file mode 100644
index 000000000..4816c1994
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk8/parent-old/pom.xml
@@ -0,0 +1,68 @@
+
+ 4.0.0
+ ch.powerunit.extensions
+ powerunit-extensions-matchers-multimodule-parent-old-it1000
+
+
+ ch.powerunit.extensions
+ powerunit-extensions-matchers-multimodule-master-it1000
+ @project.version@
+ ../pom.xml
+
+
+ jar
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+ jar
+
+
+
+
+ true
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ ${java.target.version}
+ true
+
+ -J@testcompileargs@
+
+
+
+
+
+
+
+
+ org.hamcrest
+ hamcrest-all
+ ${hamcrest.version}
+
+
+ ch.powerunit
+ powerunit
+ ${powerunit.version}
+ test
+
+
+ ch.powerunit.extensions
+ powerunit-extensions-matchers
+ 0.2.0
+
+
+
\ No newline at end of file
diff --git a/src/it/multimodule-nogeneric-it-jdk8/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo1.java b/src/it/multimodule-nogeneric-it-jdk8/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo1.java
new file mode 100644
index 000000000..2b8387c6b
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk8/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo1.java
@@ -0,0 +1,45 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.parentold;
+
+import ch.powerunit.extensions.matchers.ProvideMatchers;
+
+/**
+ * @author borettim
+ *
+ */
+@ProvideMatchers
+public class Pojo1 {
+
+ public String msg1;
+
+ public Pojo1() {
+ }
+
+ public Pojo1(String msg1) {
+ this.msg1 = msg1;
+ }
+
+ @Override
+ public String toString() {
+ return "Pojo1 [msg1=" + msg1 + "]";
+ }
+
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk8/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo2.java b/src/it/multimodule-nogeneric-it-jdk8/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo2.java
new file mode 100644
index 000000000..3d3360115
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk8/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo2.java
@@ -0,0 +1,42 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.parentold;
+
+/**
+ * @author borettim
+ *
+ */
+public class Pojo2 {
+
+ public String msg1;
+
+ public Pojo2() {
+ }
+
+ public Pojo2(String msg1) {
+ this.msg1 = msg1;
+ }
+
+ @Override
+ public String toString() {
+ return "Pojo2 [msg1=" + msg1 + "]";
+ }
+
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk8/pom.xml b/src/it/multimodule-nogeneric-it-jdk8/pom.xml
index f54929790..dc6beef5c 100644
--- a/src/it/multimodule-nogeneric-it-jdk8/pom.xml
+++ b/src/it/multimodule-nogeneric-it-jdk8/pom.xml
@@ -162,6 +162,7 @@
parent
+ parent-oldchildren
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/children/pom.xml b/src/it/multimodule-nogeneric-it-jdk9+/children/pom.xml
index 69112d8b0..d78a1ac28 100644
--- a/src/it/multimodule-nogeneric-it-jdk9+/children/pom.xml
+++ b/src/it/multimodule-nogeneric-it-jdk9+/children/pom.xml
@@ -69,6 +69,11 @@
powerunit-extensions-matchers-multimodule-parent-it1000${project.version}
+
+ ch.powerunit.extensions
+ powerunit-extensions-matchers-multimodule-parent-old-it1000
+ ${project.version}
+ javax.annotationjavax.annotation-api
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo24.java b/src/it/multimodule-nogeneric-it-jdk9+/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo24.java
new file mode 100644
index 000000000..8fa4c8819
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk9+/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo24.java
@@ -0,0 +1,51 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.children;
+
+import ch.powerunit.extensions.matchers.ProvideMatchers;
+import ch.powerunit.extensions.matchers.multi.parentold.Pojo1;
+
+/**
+ * @author borettim
+ *
+ */
+@ProvideMatchers
+public class Pojo24 extends Pojo1 {
+
+ public String msg2;
+
+ public Pojo24() {
+ }
+
+ public Pojo24(String msg2) {
+ this.msg2 = msg2;
+ }
+
+ public Pojo24(String msg1, String msg2) {
+ super(msg1);
+ this.msg2 = msg2;
+ }
+
+ @Override
+ public String toString() {
+ return "Pojo24 [msg2=" + msg2 + ", msg1=" + msg1 + "]";
+ }
+
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo26.java b/src/it/multimodule-nogeneric-it-jdk9+/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo26.java
new file mode 100644
index 000000000..b35b7d79d
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk9+/children/src/main/java/ch/powerunit/extensions/matchers/multi/children/Pojo26.java
@@ -0,0 +1,47 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.children;
+
+import ch.powerunit.extensions.matchers.ProvideMatchers;
+import ch.powerunit.extensions.matchers.multi.parentold.Pojo1;
+
+/**
+ * @author borettim
+ *
+ */
+@ProvideMatchers
+public class Pojo26 {
+
+ public Pojo1 field1;
+
+ public Pojo26() {
+ }
+
+ public Pojo26(Pojo1 field1) {
+ super();
+ this.field1 = field1;
+ }
+
+ @Override
+ public String toString() {
+ return "Pojo26 [field1=" + field1 + "]";
+ }
+
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo24MatcherTest.java b/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo24MatcherTest.java
new file mode 100644
index 000000000..5d245333a
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo24MatcherTest.java
@@ -0,0 +1,96 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.children;
+
+import ch.powerunit.TestDelegate;
+import ch.powerunit.TestSuite;
+import ch.powerunit.extensions.matchers.multi.parentold.Pojo1Matchers;
+import ch.powerunit.matchers.MatcherTester;
+import static ch.powerunit.matchers.MatcherTester.matcher;
+import static ch.powerunit.matchers.MatcherTester.value;
+
+public class Pojo24MatcherTest implements TestSuite {
+
+ //@formatter:off
+ @TestDelegate
+ public final MatcherTester> tester = testerOfMatcher(Pojo24Matchers.Pojo24MatcherImpl.class)
+ .with(
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24With().msg2ContainsString("12"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent ANYTHING]\n[msg2 a string containing \"12\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("12"),
+ new Pojo24("121"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[msg2 was \"11\"]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24With(Pojo1Matchers.pojo1With().msg1("x")).msg2ContainsString("12"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is \"x\"]\n]\n[msg2 a string containing \"12\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("x","12"),
+ new Pojo24("x","121"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[parent [msg1 was null]\n]\n[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[parent [msg1 was null]\n]\n[msg2 was \"11\"]\n"),
+ value(new Pojo24("z","11")).withMessage("[parent [msg1 was \"z\"]\n]\n[msg2 was \"11\"]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24WithSameValue(new Pojo24("x")))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is null]\n]\n[msg2 is \"x\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("x"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[msg2 was \"11\"]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24WithSameValue(new Pojo24("y","x")))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is \"y\"]\n]\n[msg2 is \"x\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("y","x"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[parent [msg1 was null]\n]\n[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[parent [msg1 was null]\n]\n[msg2 was \"11\"]\n"),
+ value(new Pojo24("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24WithSameValue(new Pojo24("y","x"),"msg2"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is \"y\"]\n]\n[msg2 ANYTHING]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("y","x"),
+ new Pojo24("y","x2"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[parent [msg1 was null]\n]\n"),
+ value(new Pojo24("11")).withMessage("[parent [msg1 was null]\n]\n"),
+ value(new Pojo24("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")),
+ matcher((Pojo24Matchers.Pojo24MatcherImpl) Pojo24Matchers.pojo24WithSameValue(new Pojo24("y","x"),"msg1"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo24 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parentold.Pojo1 with\n[msg1 is \"y\"]\n]\n[msg2 is \"x\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo24("y","x"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo24()).withMessage("[parent [msg1 was null]\n]\n[msg2 was null]\n"),
+ value(new Pojo24("11")).withMessage("[parent [msg1 was null]\n]\n[msg2 was \"11\"]\n")));
+ //@formatter:on
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo4MatcherTest.java b/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo4MatcherTest.java
index e7be3d89a..d24a8b8f9 100644
--- a/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo4MatcherTest.java
+++ b/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo4MatcherTest.java
@@ -71,6 +71,27 @@ public class Pojo4MatcherTest implements TestSuite {
value("").withMessage("was \"\""),
value(new Pojo4()).withMessage("[parent [msg1 was null]\n]\n[msg2 was null]\n"),
value(new Pojo4("11")).withMessage("[parent [msg1 was null]\n]\n[msg2 was \"11\"]\n"),
- value(new Pojo4("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")));
+ value(new Pojo4("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")),
+ matcher((Pojo4Matchers.Pojo4MatcherImpl) Pojo4Matchers.pojo4WithSameValue(new Pojo4("y","x"),"msg2"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo4 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parent.Pojo1 with\n[msg1 is \"y\"]\n]\n[msg2 ANYTHING]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo4("y","x"),
+ new Pojo4("y","x2"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo4()).withMessage("[parent [msg1 was null]\n]\n"),
+ value(new Pojo4("11")).withMessage("[parent [msg1 was null]\n]\n"),
+ value(new Pojo4("z","x")).withMessage("[parent [msg1 was \"z\"]\n]\n")),
+ matcher((Pojo4Matchers.Pojo4MatcherImpl) Pojo4Matchers.pojo4WithSameValue(new Pojo4("y","x"),"msg1"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo4 with\n[parent an instance of ch.powerunit.extensions.matchers.multi.parent.Pojo1 with\n[msg1 ANYTHING]\n]\n[msg2 is \"x\"]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo4("y","x"),
+ new Pojo4("y2","x"))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo4()).withMessage("[msg2 was null]\n"),
+ value(new Pojo4("11")).withMessage("[msg2 was \"11\"]\n")));
//@formatter:on
}
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo6MatcherTest.java b/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo6MatcherTest.java
index 184a82155..636372f66 100644
--- a/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo6MatcherTest.java
+++ b/src/it/multimodule-nogeneric-it-jdk9+/children/src/test/java/ch/powerunit/extensions/matchers/multi/children/Pojo6MatcherTest.java
@@ -70,6 +70,15 @@ public class Pojo6MatcherTest implements TestSuite {
value("").withMessage("was \"\""),
value(new Pojo6()).withMessage("[field1 was null]\n"),
value(new Pojo6(new Pojo1())).withMessage("[field1 [msg1 was null]\n]\n"),
- value(new Pojo6(new Pojo1("t"))).withMessage("[field1 [msg1 was \"t\"]\n]\n")));
+ value(new Pojo6(new Pojo1("t"))).withMessage("[field1 [msg1 was \"t\"]\n]\n")),
+ matcher((Pojo6Matchers.Pojo6MatcherImpl) Pojo6Matchers.pojo6WithSameValue(new Pojo6(new Pojo1("a")),"field1.msg1"))
+ .describedAs("an instance of ch.powerunit.extensions.matchers.multi.children.Pojo6 with\n[field1 an instance of ch.powerunit.extensions.matchers.multi.parent.Pojo1 with\n[msg1 ANYTHING]\n]\n")
+ .nullRejected("was null")
+ .accepting(
+ new Pojo6(new Pojo1("a")),
+ new Pojo6(new Pojo1("b")))
+ .rejecting(
+ value("").withMessage("was \"\""),
+ value(new Pojo6()).withMessage("[field1 was null]\n")));
//@formatter:on
}
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/parent-old/pom.xml b/src/it/multimodule-nogeneric-it-jdk9+/parent-old/pom.xml
new file mode 100644
index 000000000..9b17ddbd2
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk9+/parent-old/pom.xml
@@ -0,0 +1,73 @@
+
+ 4.0.0
+ ch.powerunit.extensions
+ powerunit-extensions-matchers-multimodule-parent-old-it1000
+
+
+ ch.powerunit.extensions
+ powerunit-extensions-matchers-multimodule-master-it1000
+ @project.version@
+ ../pom.xml
+
+
+ jar
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+
+ jar
+
+
+
+
+ true
+ false
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ ${java.target.version}
+ true
+
+ -J@testcompileargs@
+
+
+
+
+
+
+
+
+ org.hamcrest
+ hamcrest-all
+ ${hamcrest.version}
+
+
+ ch.powerunit
+ powerunit
+ ${powerunit.version}
+ test
+
+
+ ch.powerunit.extensions
+ powerunit-extensions-matchers
+ 0.2.0
+
+
+ javax.annotation
+ javax.annotation-api
+ 1.3.2
+
+
+
\ No newline at end of file
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo1.java b/src/it/multimodule-nogeneric-it-jdk9+/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo1.java
new file mode 100644
index 000000000..2b8387c6b
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk9+/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo1.java
@@ -0,0 +1,45 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.parentold;
+
+import ch.powerunit.extensions.matchers.ProvideMatchers;
+
+/**
+ * @author borettim
+ *
+ */
+@ProvideMatchers
+public class Pojo1 {
+
+ public String msg1;
+
+ public Pojo1() {
+ }
+
+ public Pojo1(String msg1) {
+ this.msg1 = msg1;
+ }
+
+ @Override
+ public String toString() {
+ return "Pojo1 [msg1=" + msg1 + "]";
+ }
+
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo2.java b/src/it/multimodule-nogeneric-it-jdk9+/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo2.java
new file mode 100644
index 000000000..3d3360115
--- /dev/null
+++ b/src/it/multimodule-nogeneric-it-jdk9+/parent-old/src/main/java/ch/powerunit/extensions/matchers/multi/parentold/Pojo2.java
@@ -0,0 +1,42 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.multi.parentold;
+
+/**
+ * @author borettim
+ *
+ */
+public class Pojo2 {
+
+ public String msg1;
+
+ public Pojo2() {
+ }
+
+ public Pojo2(String msg1) {
+ this.msg1 = msg1;
+ }
+
+ @Override
+ public String toString() {
+ return "Pojo2 [msg1=" + msg1 + "]";
+ }
+
+}
diff --git a/src/it/multimodule-nogeneric-it-jdk9+/pom.xml b/src/it/multimodule-nogeneric-it-jdk9+/pom.xml
index f54929790..dc6beef5c 100644
--- a/src/it/multimodule-nogeneric-it-jdk9+/pom.xml
+++ b/src/it/multimodule-nogeneric-it-jdk9+/pom.xml
@@ -162,6 +162,7 @@
parent
+ parent-oldchildren
diff --git a/src/main/java/ch/powerunit/extensions/matchers/common/AbstractRoundMirrorSupport.java b/src/main/java/ch/powerunit/extensions/matchers/common/AbstractRoundMirrorSupport.java
index 6ba55d010..937788f55 100644
--- a/src/main/java/ch/powerunit/extensions/matchers/common/AbstractRoundMirrorSupport.java
+++ b/src/main/java/ch/powerunit/extensions/matchers/common/AbstractRoundMirrorSupport.java
@@ -62,9 +62,4 @@ default String getAnnotationProcessorVersion() {
return getClass().getPackage().getImplementationVersion();
}
- default long getCompatibility() {
- // No specify bit for the moment
- return 0L;
- }
-
}
diff --git a/src/main/java/ch/powerunit/extensions/matchers/common/ListJoining.java b/src/main/java/ch/powerunit/extensions/matchers/common/ListJoining.java
index 458f28230..4a5864160 100644
--- a/src/main/java/ch/powerunit/extensions/matchers/common/ListJoining.java
+++ b/src/main/java/ch/powerunit/extensions/matchers/common/ListJoining.java
@@ -23,7 +23,7 @@
import static java.util.stream.Collectors.joining;
import java.util.Arrays;
-import java.util.List;
+import java.util.Collection;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.UnaryOperator;
@@ -107,7 +107,7 @@ public ListJoining(Function mapper, String delimiter, UnaryOperator input) {
+ public String asString(Collection input) {
return Objects.requireNonNull(input, "input can't be null").stream().map(mapper)
.collect(collectingAndThen(joining(delimiter), finalizer));
}
diff --git a/src/main/java/ch/powerunit/extensions/matchers/common/RessourceLoaderHelper.java b/src/main/java/ch/powerunit/extensions/matchers/common/RessourceLoaderHelper.java
new file mode 100644
index 000000000..118827b87
--- /dev/null
+++ b/src/main/java/ch/powerunit/extensions/matchers/common/RessourceLoaderHelper.java
@@ -0,0 +1,39 @@
+/**
+ * Powerunit - A JDK1.8 test framework
+ * Copyright (C) 2014 Mathieu Boretti.
+ *
+ * This file is part of Powerunit
+ *
+ * Powerunit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Powerunit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Powerunit. If not, see .
+ */
+package ch.powerunit.extensions.matchers.common;
+
+import java.util.Scanner;
+
+public final class RessourceLoaderHelper {
+
+ private RessourceLoaderHelper() {
+ }
+
+ public static String loadRessource(Class> clazz, String ressource) {
+ try (Scanner s = new Scanner(clazz.getResourceAsStream(ressource))) {
+ StringBuilder builder = new StringBuilder();
+ while (s.hasNext()) {
+ builder.append(s.nextLine()).append("\n");
+ }
+ return builder.toString();
+ }
+ }
+
+}
diff --git a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/Matchable.java b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/Matchable.java
index f07a15266..383f271c5 100644
--- a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/Matchable.java
+++ b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/Matchable.java
@@ -28,6 +28,11 @@ public interface Matchable {
String getSimpleNameOfGeneratedInterfaceMatcher();
+ default long getCompatibility() {
+ // 0x01 : withSameValue also provides a version to ignore fields
+ return 0x01;
+ }
+
default String getMethodNameDSLWithSameValue() {
return getMethodShortClassName() + "WithSameValue";
}
@@ -40,7 +45,12 @@ default String getWithSameValue(boolean hasReference) {
return getFullyQualifiedNameOfGeneratedClass() + (hasReference ? "::" : ".") + getMethodNameDSLWithSameValue();
}
- static Matchable of(String fullName, String methodName, String interfaceName, boolean hasWithSameValue) {
+ default boolean supportIgnore() {
+ return (getCompatibility() & 0x01) == 0x01;
+ }
+
+ static Matchable of(String fullName, String methodName, String interfaceName, boolean hasWithSameValue,
+ long compatibility) {
return new Matchable() {
@Override
@@ -62,6 +72,11 @@ public String getMethodShortClassName() {
public String getFullyQualifiedNameOfGeneratedClass() {
return fullName;
}
+
+ @Override
+ public long getCompatibility() {
+ return compatibility;
+ }
};
}
}
diff --git a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/NameExtractorVisitor.java b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/NameExtractorVisitor.java
index 8c0db825c..183c17303 100644
--- a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/NameExtractorVisitor.java
+++ b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/NameExtractorVisitor.java
@@ -42,43 +42,8 @@ public NameExtractorVisitor(RoundMirror support) {
}
@Override
- public Optional visitPrimitiveAsBoolean(PrimitiveType t, Boolean asPrimitif) {
- return of((asPrimitif) ? "boolean" : "Boolean");
- }
-
- @Override
- public Optional visitPrimitiveAsByte(PrimitiveType t, Boolean asPrimitif) {
- return of((asPrimitif) ? "byte" : "Byte");
- }
-
- @Override
- public Optional visitPrimitiveAsShort(PrimitiveType t, Boolean asPrimitif) {
- return of((asPrimitif) ? "short" : "Short");
- }
-
- @Override
- public Optional visitPrimitiveAsInt(PrimitiveType t, Boolean asPrimitif) {
- return of((asPrimitif) ? "int" : "Integer");
- }
-
- @Override
- public Optional visitPrimitiveAsLong(PrimitiveType t, Boolean asPrimitif) {
- return of((asPrimitif) ? "long" : "Long");
- }
-
- @Override
- public Optional visitPrimitiveAsChar(PrimitiveType t, Boolean asPrimitif) {
- return of((asPrimitif) ? "char" : "Character");
- }
-
- @Override
- public Optional visitPrimitiveAsFloat(PrimitiveType t, Boolean asPrimitif) {
- return of((asPrimitif) ? "float" : "Float");
- }
-
- @Override
- public Optional visitPrimitiveAsDouble(PrimitiveType t, Boolean asPrimitif) {
- return of((asPrimitif) ? "double" : "Double");
+ public Optional visitPrimitive(PrimitiveType t, Boolean asPrimitif) {
+ return of(asPrimitif ? t.toString() : getProcessingEnv().getTypeUtils().boxedClass(t).toString());
}
@Override
diff --git a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvideMatchersAnnotationMirror.java b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvideMatchersAnnotationMirror.java
index d6254443f..66e383589 100644
--- a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvideMatchersAnnotationMirror.java
+++ b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvideMatchersAnnotationMirror.java
@@ -60,4 +60,11 @@ public String[] extensions() {
return realAnnotation.extensions();
}
+ /**
+ * @return the realAnnotation
+ */
+ public ProvideMatchers getRealAnnotation() {
+ return realAnnotation;
+ }
+
}
diff --git a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvideMatchersMirror.java b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvideMatchersMirror.java
index 5b06fca2e..433989f83 100644
--- a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvideMatchersMirror.java
+++ b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvideMatchersMirror.java
@@ -20,7 +20,9 @@
package ch.powerunit.extensions.matchers.provideprocessor;
import static ch.powerunit.extensions.matchers.common.CommonUtils.asStandardMethodName;
+import static java.util.Arrays.stream;
import static java.util.stream.Collectors.collectingAndThen;
+import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
import java.util.Collection;
@@ -38,10 +40,6 @@ public class ProvideMatchersMirror extends ProvideMatchersAnnotationMirror imple
private static final String DEFAULT_PARAM_PARENT = " * @param <_PARENT> used to reference, if necessary, a parent for this builder. By default Void is used an indicate no parent builder.\n";
- public static final String JAVADOC_WARNING_SYNTAXIC_SUGAR_NO_CHANGE_ANYMORE = "This method is a syntaxic sugar that end the DSL and make clear that the matcher can't be change anymore.";
-
- public static final String JAVADOC_WARNING_PARENT_MAY_BE_VOID = "This method only works in the context of a parent builder. If the real type is Void, then nothing will be returned.";
-
protected final String simpleNameOfGeneratedClass;
protected final String packageNameOfGeneratedClass;
protected final String simpleNameOfGeneratedInterfaceMatcher;
@@ -102,38 +100,17 @@ private Function asJavadocFormat(String prefix) {
}
private String paramToJavadoc(Optional param) {
- return param.map(asJavadocFormat(" * @param ")).orElse("");
- }
-
- protected String generateJavaDocWithoutParamNeitherParent(String description, String moreDetails,
- Optional param, Optional returnDescription) {
- return String.format("/**\n * %1$s.\n *
\n * ")).orElse(""),
paramToJavadoc(param), getParamComment(), withParent ? DEFAULT_PARAM_PARENT : "", returnDescription);
}
- protected String generateJavaDoc(String description, boolean withParent) {
- return String.format("/**\n * %1$s.\n%2$s * \n%3$s */\n", description, getParamComment(),
- withParent ? DEFAULT_PARAM_PARENT : "");
- }
-
- public String generateMainJavaDoc() {
- return String.format(
- "/**\n* This class provides matchers for the class {@link %1$s}.\n * \n * @see %1$s The class for which matchers are provided.\n */\n",
- getFullyQualifiedNameOfClassAnnotated());
- }
-
private String getDefaultDescriptionForDsl() {
return "Start a DSL matcher for the " + getDefaultLinkForAnnotatedClass();
}
diff --git a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementData.java b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementData.java
index b5cf5d690..78556f99b 100644
--- a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementData.java
+++ b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementData.java
@@ -23,7 +23,7 @@
@FunctionalInterface
public interface ProvidesMatchersAnnotatedElementData extends RoundMirrorSupport {
- ProvidesMatchersAnnotatedElementFieldMatcherMirror getFullData();
+ ProvidesMatchersAnnotatedElementMatcherMirror getFullData();
default RoundMirror getRoundMirror() {
return getFullData().getRoundMirror();
diff --git a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementFieldMatcherMirror.java b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementFieldMatcherMirror.java
deleted file mode 100644
index c70d061a6..000000000
--- a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementFieldMatcherMirror.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Powerunit - A JDK1.8 test framework
- * Copyright (C) 2014 Mathieu Boretti.
- *
- * This file is part of Powerunit
- *
- * Powerunit is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Powerunit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Powerunit. If not, see .
- */
-package ch.powerunit.extensions.matchers.provideprocessor;
-
-import static ch.powerunit.extensions.matchers.common.CommonUtils.addPrefix;
-import static java.util.stream.Collectors.collectingAndThen;
-import static java.util.stream.Collectors.groupingBy;
-import static java.util.stream.Collectors.joining;
-import static java.util.stream.Collectors.reducing;
-import static java.util.stream.Collectors.toList;
-
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-import javax.lang.model.element.TypeElement;
-
-import ch.powerunit.extensions.matchers.common.CommonUtils;
-import ch.powerunit.extensions.matchers.common.ListJoining;
-import ch.powerunit.extensions.matchers.provideprocessor.fields.AbstractFieldDescription;
-import ch.powerunit.extensions.matchers.provideprocessor.fields.FieldDescriptionMetaData;
-import ch.powerunit.extensions.matchers.provideprocessor.fields.IgnoreFieldDescription;
-
-public abstract class ProvidesMatchersAnnotatedElementFieldMatcherMirror
- extends ProvidesMatchersAnnotatedElementGeneralMirror {
-
- private static final Comparator COMPARING_FIELD_BY_NAME = Comparator
- .comparing(FieldDescriptionMetaData::getFieldName);
-
- private static final String DEFAULT_FEATUREMATCHER_FORCONVERTER = "\n private static <_TARGET,_SOURCE> org.hamcrest.Matcher<_SOURCE> asFeatureMatcher(\n String msg,\n java.util.function.Function<_SOURCE,_TARGET> converter,\n org.hamcrest.Matcher super _TARGET> matcher) {\n return new org.hamcrest.FeatureMatcher<_SOURCE,_TARGET>(matcher, msg, msg) {\n protected _TARGET featureValueOf(_SOURCE actual) {\n return converter.apply(actual);\n }};\n }\n\n";
-
- protected final List fields;
-
- private final String fieldsMatcher;
-
- private static AbstractFieldDescription reduceByOrderingOnIgnoreFieldDescription(AbstractFieldDescription l,
- AbstractFieldDescription r) {
- return Optional.ofNullable(l).filter(c -> c instanceof IgnoreFieldDescription).orElse(r);
- }
-
- private List generateFields(TypeElement typeElement,
- ProvidesMatchersSubElementVisitor providesMatchersSubElementVisitor) {
- return typeElement.getEnclosedElements().stream().map(ie -> ie.accept(providesMatchersSubElementVisitor, this))
- .filter(Optional::isPresent).map(Optional::get)
- .collect(collectingAndThen(groupingBy(FieldDescriptionMetaData::getFieldName, reducing(
- ProvidesMatchersAnnotatedElementFieldMatcherMirror::reduceByOrderingOnIgnoreFieldDescription)),
- Map::values))
- .stream().filter(Optional::isPresent).map(Optional::get).sorted(COMPARING_FIELD_BY_NAME)
- .collect(toList());
- }
-
- public ProvidesMatchersAnnotatedElementFieldMatcherMirror(TypeElement typeElement, RoundMirror roundMirror) {
- super(typeElement, roundMirror);
- this.fields = generateFields(typeElement, new ProvidesMatchersSubElementVisitor(roundMirror));
- this.fieldsMatcher = fields.stream().map(FieldDescriptionMetaData::getMatcherForField)
- .map(f -> addPrefix(" ", f)).collect(joining("\n")) + "\n";
- }
-
- public String generateMatchers() {
- return new StringBuilder(DEFAULT_FEATUREMATCHER_FORCONVERTER).append(fieldsMatcher)
- .append(fullyQualifiedNameOfSuperClassOfClassAnnotated.map(this::generateParentMatcher).orElse(""))
- .toString();
- }
-
- public String generateParentMatcher(String parent) {
- return String.format(
- " private static class SuperClassMatcher%1$s extends org.hamcrest.FeatureMatcher<%2$s,%3$s> {\n\n public SuperClassMatcher(org.hamcrest.Matcher super %3$s> matcher) {\n super(matcher,\"parent\",\"parent\");\n }\n\n\n protected %3$s featureValueOf(%2$s actual) {\n return actual;\n }\n\n }\n\n\n",
- fullGeneric, getFullyQualifiedNameOfClassAnnotated(), parent);
- }
-
- public String generateMetadata() {
- // @formatter:off
- return "\n\n"
- + " // ---------------------------------------------------------------------------\n"
- + " // METADATA\n\n"
- + " /**\n"
- + " * Metadata regarding this matcher.\n"
- + " */\n"
- + " public static final Metadata METADATA = new Metadata();\n\n"
- +" public static final class FieldMetadata {\n public final String NAME, TYPE, ACCESSOR, STEREOTYPE;\n public final boolean IGNORED;\n private FieldMetadata(String name, String type, String accessor,String stereotype, boolean ignored) {\n NAME=name; TYPE=type; ACCESSOR=accessor; STEREOTYPE=stereotype; IGNORED=ignored;\n }\n }\n\n"
- + " public static final class Metadata {\n\n"
- + " private Metadata() {}\n\n"
- + " public final String ANNOTATION_PROCESSOR_VERSION = \"" + getAnnotationProcessorVersion() + "\";\n\n"
- + " public final long COMPATIBILITY = " + getCompatibility() + ";\n\n"
- + " public final String SOURCE_CLASS_NAME = \"" + getFullyQualifiedNameOfClassAnnotatedWithProvideMatcherWithGeneric() + "\";\n\n"
- + " public final Class<"+getFullyQualifiedNameOfClassAnnotated()+"> SOURCE_CLASS = " + getFullyQualifiedNameOfClassAnnotated() + ".class;\n\n"
- + " public final String SOURCE_PARENT_CLASS_NAME = " + fullyQualifiedNameOfSuperClassOfClassAnnotated.map(CommonUtils::toJavaSyntax).orElse("null") + ";\n\n"
- + " public final FieldMetadata[] FIELDS = new FieldMetadata[]{ " +ListJoining.joinWithMapperAndDelimiter(f->f.generateMetadata("FieldMetadata"), ", ").asString(fields) + " };\n\n"
- + " }\n";
- // @formatter:on
- }
-
-}
diff --git a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementMatcherMirror.java b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementMatcherMirror.java
index 5d942b9ee..a41bf7ee1 100644
--- a/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementMatcherMirror.java
+++ b/src/main/java/ch/powerunit/extensions/matchers/provideprocessor/ProvidesMatchersAnnotatedElementMatcherMirror.java
@@ -20,185 +20,136 @@
package ch.powerunit.extensions.matchers.provideprocessor;
import static ch.powerunit.extensions.matchers.common.CommonUtils.addPrefix;
-import static java.util.stream.Collectors.joining;
-
-import java.util.Arrays;
+import static ch.powerunit.extensions.matchers.common.ListJoining.joinWithMapperAndDelimiter;
+import static java.lang.String.format;
+import static java.util.Collections.unmodifiableList;
+import static java.util.stream.Collectors.collectingAndThen;
+import static java.util.stream.Collectors.groupingBy;
+import static java.util.stream.Collectors.reducing;
+import static java.util.stream.Collectors.toList;
+
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
import java.util.Optional;
import javax.lang.model.element.TypeElement;
+import ch.powerunit.extensions.matchers.common.CommonUtils;
+import ch.powerunit.extensions.matchers.common.ListJoining;
+import ch.powerunit.extensions.matchers.common.RessourceLoaderHelper;
import ch.powerunit.extensions.matchers.provideprocessor.fields.AbstractFieldDescription;
+import ch.powerunit.extensions.matchers.provideprocessor.fields.FieldDescriptionMetaData;
+import ch.powerunit.extensions.matchers.provideprocessor.fields.IgnoreFieldDescription;
+import ch.powerunit.extensions.matchers.provideprocessor.helper.FeatureMatcher;
public abstract class ProvidesMatchersAnnotatedElementMatcherMirror
- extends ProvidesMatchersAnnotatedElementFieldMatcherMirror {
+ extends ProvidesMatchersAnnotatedElementGeneralMirror {
- private static final String PRIVATE_IMPLEMENTATION_END = "\n\n @Override\n public _PARENT end() {\n return _parentBuilder;\n }\n\n\n";
+ private static final String INTERFACE_FORMAT = RessourceLoaderHelper
+ .loadRessource(ProvidesMatchersAnnotatedElementMatcherMirror.class, "MatchersInterface.txt");
- private static final String NEXTMATCHERS_DESCRIBETO = " for(org.hamcrest.Matcher nMatcher : nextMatchers) {\n description.appendText(\"[object itself \").appendDescriptionOf(nMatcher).appendText(\"]\\n\");\n }\n }\n";
+ private static final String IMPLEMENTATION_NO_PARENT_FORMAT = RessourceLoaderHelper
+ .loadRessource(ProvidesMatchersAnnotatedElementMatcherMirror.class, "MatchersImplementationNoParent.txt");
- private static final String PARENT_DESCRIBETO = " description.appendText(\"[\").appendDescriptionOf(_parent).appendText(\"]\\n\");\n";
+ private static final String IMPLEMENTATION_PARENT_FORMAT = RessourceLoaderHelper
+ .loadRessource(ProvidesMatchersAnnotatedElementMatcherMirror.class, "MatchersImplementationParent.txt");
- private static final String PARENT_VALIDATION = " if(!_parent.matches(actual)) {\n mismatchDescription.appendText(\"[\"); _parent.describeMismatch(actual,mismatchDescription); mismatchDescription.appendText(\"]\\n\");\n result=false;\n }\n";
+ private static final String METADATA_FORMAT = RessourceLoaderHelper
+ .loadRessource(ProvidesMatchersAnnotatedElementMatcherMirror.class, "MatchersMetadata.txt");
- private static final String NEXTMATCHERS_VALIDATION = " for(org.hamcrest.Matcher nMatcher : nextMatchers) {\n if(!nMatcher.matches(actual)) {\n mismatchDescription.appendText(\"[object itself \"); nMatcher.describeMismatch(actual,mismatchDescription); mismatchDescription.appendText(\"]\\n\");\n result=false;\n }\n }\n return result;\n }\n\n";
+ private static final ListJoining JOIN_FIELD_DSL_INTERFACE = joinWithMapperAndDelimiter(
+ s -> addPrefix(" ", s.getDslInterface()), "\n");
- private static final String JAVADOC_ANDWITHAS = " /**\n * Add a matcher on the object itself and not on a specific field, but convert the object before passing it to the matcher.\n *
\n * This method, when used more than once, just add more matcher to the list.\n * @param converter the function to convert the object.\n * @param otherMatcher the matcher on the converter object itself.\n * @param <_TARGETOBJECT> the type of the target object\n * @return the DSL to continue\n */\n";
+ private static final ListJoining JOIN_FIELD_MATCHERFIELD = joinWithMapperAndDelimiter(
+ s -> addPrefix(" ", s.asMatcherField()), "\n");
- private static final String JAVADOC_ANDWITH = " /**\n * Add a matcher on the object itself and not on a specific field.\n *
\n * This method, when used more than once, just add more matcher to the list.\n * @param otherMatcher the matcher on the object itself.\n * @return the DSL to continue\n */\n";
+ private static final ListJoining JOIN_FIELD_IMPL = joinWithMapperAndDelimiter(
+ s -> addPrefix(" ", s.getImplementationInterface()), "\n");
- private final String dslInterfaceDescription;
+ private static final ListJoining JOIN_FIELD_MATCHES_SAFELY = joinWithMapperAndDelimiter(
+ s -> addPrefix(" ", s.asMatchesSafely() + "\n"), "\n");
- public ProvidesMatchersAnnotatedElementMatcherMirror(TypeElement typeElement, RoundMirror roundMirror) {
- super(typeElement, roundMirror);
- this.dslInterfaceDescription = "DSL interface for matcher on " + getDefaultLinkForAnnotatedClass();
- }
+ private static final ListJoining JOIN_FIELD_DESCRIBE_TO = joinWithMapperAndDelimiter(
+ s -> addPrefix(" ", s.asDescribeTo() + "\n"), "\n");
- public String generatePublicInterface() {
- return new StringBuilder().append(generateMainBuildPublicInterface())
- .append(generateMainParentPublicInterface()).append(generateExposedPublicInterface()).toString();
+ private static final ListJoining JOIN_FIELD_MATCHER = joinWithMapperAndDelimiter(
+ f -> addPrefix(" ", f.getMatcherForField()), "\n");
- }
+ private static final ListJoining JOIN_FIELD_METADATA = joinWithMapperAndDelimiter(
+ f -> f.generateMetadata("FieldMetadata"), ", ");
- private String generateExposedPublicInterface() {
- String simpleName = simpleNameOfGeneratedInterfaceMatcher;
- return new StringBuilder(addPrefix(" ", generateDefaultJavaDoc())).append("\n")
- .append(" public static interface ").append(simpleName).append(getFullGenericParent())
- .append(" extends org.hamcrest.Matcher<")
- .append(getFullyQualifiedNameOfClassAnnotatedWithProvideMatcherWithGeneric()).append(">,")
- .append(simpleName).append("BuildSyntaxicSugar ").append(generic).append(",").append(simpleName)
- .append("EndSyntaxicSugar ").append(getGenericParent()).append(" {\n")
- .append(fields.stream().map(AbstractFieldDescription::getDslInterface).map(s -> addPrefix(" ", s))
- .collect(joining("\n")))
- .append("\n\n").append(generateAsPublicInterface()).append(" }\n").toString();
- }
+ private static final Comparator COMPARING_FIELD_BY_NAME = Comparator
+ .comparing(FieldDescriptionMetaData::getFieldName);
+
+ private static final String DEFAULT_FEATUREMATCHER_FORCONVERTER = "\n private static <_TARGET,_SOURCE> org.hamcrest.Matcher<_SOURCE> asFeatureMatcher(\n String msg,\n java.util.function.Function<_SOURCE,_TARGET> converter,\n org.hamcrest.Matcher super _TARGET> matcher) {\n return new org.hamcrest.FeatureMatcher<_SOURCE,_TARGET>(matcher, msg, msg) {\n protected _TARGET featureValueOf(_SOURCE actual) {\n return converter.apply(actual);\n }};\n }\n\n";
- private String generateAsPublicInterface() {
- String fully = getFullyQualifiedNameOfClassAnnotatedWithProvideMatcherWithGeneric();
- String otherMatcher = "org.hamcrest.Matcher super " + fully + "> otherMatcher";
- String interfaceWithGeneric = getSimpleNameOfGeneratedInterfaceMatcherWithGenericParent();
-
- StringBuilder sb = new StringBuilder(JAVADOC_ANDWITH).append(" ").append(interfaceWithGeneric)
- .append(" andWith(").append(otherMatcher).append(");\n\n");
-
- sb.append(JAVADOC_ANDWITHAS).append(String.format(
- " default <_TARGETOBJECT> %1$s andWithAs(java.util.function.Function<%2$s,_TARGETOBJECT> converter,org.hamcrest.Matcher super _TARGETOBJECT> otherMatcher) {\n return andWith(asFeatureMatcher(\"