3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
JAVA_PKG_IUSE="doc source test"
|
7 |
|
MAVEN_ID="org.mockito:mockito-core:${PV}"
|
8 |
|
JAVA_TESTING_FRAMEWORKS="junit-4"
|
|
6 |
# Tests not enabled, wants junit-jupiter.
|
|
7 |
# "${S}/settings.gradle.kts"
|
|
8 |
JAVA_PKG_IUSE="doc source"
|
|
9 |
MAVEN_ID="org.mockito:mockito-core:4.11.0"
|
9 |
10 |
|
10 |
11 |
inherit java-pkg-2 java-pkg-simple
|
11 |
12 |
|
12 |
13 |
DESCRIPTION="Mockito mock objects library core API and implementation"
|
13 |
14 |
HOMEPAGE="https://github.com/mockito/mockito"
|
14 |
15 |
SRC_URI="https://github.com/mockito/mockito/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
15 |
|
S="${WORKDIR}/${P}"
|
16 |
16 |
|
17 |
17 |
LICENSE="MIT"
|
18 |
|
SLOT="2"
|
19 |
|
KEYWORDS="amd64 ~arm ~arm64 ppc64 x86"
|
|
18 |
SLOT="4"
|
|
19 |
KEYWORDS="amd64 ~arm arm64 ppc64 x86"
|
20 |
20 |
|
21 |
21 |
CP_DEPEND="
|
22 |
22 |
dev-java/asm:9
|
... | ... | |
29 |
29 |
dev-java/opentest4j:0
|
30 |
30 |
>=virtual/jdk-1.8:*
|
31 |
31 |
${CP_DEPEND}
|
32 |
|
test? ( dev-java/assertj-core:3 )
|
33 |
32 |
"
|
34 |
33 |
|
35 |
34 |
RDEPEND="
|
... | ... | |
37 |
36 |
${CP_DEPEND}
|
38 |
37 |
"
|
39 |
38 |
|
40 |
|
# see https://bugs.gentoo.org/903897
|
41 |
|
PATCHES=( "${FILESDIR}/mockito-2.28.2-skip-failing-tests.patch" )
|
|
39 |
S="${WORKDIR}/${P}"
|
42 |
40 |
|
43 |
41 |
JAVA_AUTOMATIC_MODULE_NAME="org.mockito"
|
44 |
42 |
JAVA_CLASSPATH_EXTRA="junit-4 opentest4j"
|
45 |
43 |
JAVA_SRC_DIR="src/main/java"
|
46 |
44 |
|
47 |
|
JAVA_TEST_EXCLUDES=(
|
48 |
|
org.mockito.internal.junit.JUnitRuleTest # We run it in JAVA_TEST_RUN_ONLY
|
49 |
|
org.mockito.internal.util.reflection.DummyClassForTests # No runnable methods
|
50 |
|
org.mockito.internal.util.reflection.DummyParentClassForTests # No runnable methods
|
51 |
|
org.mockito.junit.TestableJUnitRunner # No runnable methods
|
52 |
|
org.mockitoutil.TestBase # No runnable methods
|
53 |
|
)
|
54 |
|
JAVA_TEST_GENTOO_CLASSPATH="assertj-core-3,junit-4"
|
55 |
|
JAVA_TEST_RUN_ONLY=(
|
56 |
|
# This needs to run separately, otherwise one of its 4 tests would fail.
|
57 |
|
org.mockito.internal.junit.JUnitRuleTest
|
58 |
|
)
|
59 |
|
JAVA_TEST_SRC_DIR="src/test/java"
|
60 |
|
|
61 |
45 |
src_prepare() {
|
62 |
|
java-pkg-2_src_prepare
|
63 |
46 |
default
|
64 |
47 |
# dev-java/byte-buddy is built from byte-buddy-dep without shaded stuff.
|
65 |
48 |
sed \
|
... | ... | |
67 |
50 |
-i src/main/java/org/mockito/internal/creation/bytebuddy/MockMethodAdvice.java \
|
68 |
51 |
-i src/main/java/org/mockito/internal/creation/bytebuddy/InlineBytecodeGenerator.java || die
|
69 |
52 |
}
|
70 |
|
|
71 |
|
src_compile() {
|
72 |
|
java-pkg-simple_src_compile
|
73 |
|
mv target/classes/org/mockito/internal/creation/bytebuddy/inject/MockMethodDispatcher.{class,raw} || die
|
74 |
|
jar ufv mockito.jar -C target/classes org/mockito/internal/creation/bytebuddy/inject/MockMethodDispatcher.raw || die
|
75 |
|
}
|
76 |
|
|
77 |
|
src_test() {
|
78 |
|
# Increasing number of test failures with higher Java versions
|
79 |
|
# Test failures are documented in https://bugs.gentoo.org/903897
|
80 |
|
local vm_version="$(java-config -g PROVIDES_VERSION)"
|
81 |
|
if ver_test "${vm_version}" -ge 11; then
|
82 |
|
JAVA_TEST_EXCLUDES+=(
|
83 |
|
org.mockito.internal.stubbing.defaultanswers.ReturnsMocksTest
|
84 |
|
org.mockitousage.bugs.GenericsMockitoAnnotationsTest
|
85 |
|
)
|
86 |
|
fi
|
87 |
|
if ver_test "${vm_version}" -ge 17; then
|
88 |
|
JAVA_TEST_EXCLUDES+=(
|
89 |
|
org.concurrentmockito.ThreadsRunAllTestsHalfManualTest
|
90 |
|
org.mockitousage.matchers.InvalidUseOfMatchersTest
|
91 |
|
org.mockitousage.serialization.DeepStubsSerializableTest
|
92 |
|
org.mockitousage.stubbing.StubbingWithDelegateTest
|
93 |
|
)
|
94 |
|
JAVA_TEST_EXTRA_ARGS+=( --add-opens=java.base/java.io=ALL-UNNAMED )
|
95 |
|
JAVA_TEST_EXTRA_ARGS+=( --add-opens=java.base/java.lang=ALL-UNNAMED )
|
96 |
|
JAVA_TEST_EXTRA_ARGS+=( --add-opens=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED )
|
97 |
|
fi
|
98 |
|
# First run what needs to run separately
|
99 |
|
java-pkg-simple_src_test
|
100 |
|
# And then the other tests
|
101 |
|
JAVA_TEST_RUN_ONLY=""
|
102 |
|
java-pkg-simple_src_test
|
103 |
|
}
|