You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by me...@apache.org on 2025/08/22 18:28:56 UTC
(fineract) branch auto-close-static-mocks created (now 239bfe1da1)
This is an automated email from the ASF dual-hosted git repository.
meonkeys pushed a change to branch auto-close-static-mocks
in repository https://gitbox.apache.org/repos/asf/fineract.git
at 239bfe1da1 WIP test fix for MockitoException
This branch includes the following new commits:
new a2880413de WIP use gradle to aggregate (non-e2e) test results
new f6ee4b61df WIP - simplify config
new 239bfe1da1 WIP test fix for MockitoException
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(fineract) 02/03: WIP - simplify config
Posted by me...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
meonkeys pushed a commit to branch auto-close-static-mocks
in repository https://gitbox.apache.org/repos/asf/fineract.git
commit f6ee4b61df6cd1e177b23e8e92df5a223b140ce4
Author: Adam Monsen <ha...@gmail.com>
AuthorDate: Tue Aug 5 12:24:26 2025 -0700
WIP - simplify config
---
test-results/build.gradle | 40 +---------------------------------------
1 file changed, 1 insertion(+), 39 deletions(-)
diff --git a/test-results/build.gradle b/test-results/build.gradle
index 7919c15837..daf8dd1e4c 100644
--- a/test-results/build.gradle
+++ b/test-results/build.gradle
@@ -17,49 +17,16 @@
* under the License.
*/
-//apply plugin: 'test-report-aggregation'
-
plugins {
id 'test-report-aggregation'
}
description = 'Aggregate Test Results'
-// Declare dependencies using the testReportAggregation configuration
-// (list project results to aggregate here)
dependencies {
- // EVERYTHING. Doesn't work because we don't/can't run them all at once.
- //testReportAggregation fineractJavaProjects
-
- // FIXME - old project? delete?
- //testReportAggregation project(':fineract-api')
-
- // specific projects only (all but e2e) -- this is probably the way to go
- testReportAggregation project(':fineract-core')
- testReportAggregation project(':fineract-cob')
- testReportAggregation project(':fineract-validation')
- testReportAggregation project(':fineract-command')
- testReportAggregation project(':fineract-accounting')
- testReportAggregation project(':fineract-provider')
- testReportAggregation project(':fineract-branch')
- testReportAggregation project(':fineract-document')
- testReportAggregation project(':fineract-investor')
- testReportAggregation project(':fineract-charge')
- testReportAggregation project(':fineract-rates')
- testReportAggregation project(':fineract-tax')
- testReportAggregation project(':fineract-loan')
- testReportAggregation project(':fineract-savings')
- testReportAggregation project(':fineract-report')
- testReportAggregation project(':integration-tests')
- testReportAggregation project(':twofactor-tests')
- testReportAggregation project(':oauth2-tests')
- testReportAggregation project(':fineract-client')
- testReportAggregation project(':fineract-avro-schemas')
- testReportAggregation project(':fineract-progressive-loan')
- testReportAggregation project(':fineract-progressive-loan-embeddable-schedule-generator')
+ testReportAggregation fineractJavaProjects
}
-// Define a report of type AggregateTestReport which collects test data from unit test suites
reporting {
reports {
testAggregateTestReport(AggregateTestReport) {
@@ -67,8 +34,3 @@ reporting {
}
}
}
-
-// make aggregate test report generation part of the 'check' lifecycle phase
-//tasks.named('check') {
-// dependsOn tasks.named('testAggregateTestReport', TestReport)
-//}
(fineract) 03/03: WIP test fix for MockitoException
Posted by me...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
meonkeys pushed a commit to branch auto-close-static-mocks
in repository https://gitbox.apache.org/repos/asf/fineract.git
commit 239bfe1da15eabe64101001af12e7e4e5ad57054
Author: Adam Monsen <ha...@gmail.com>
AuthorDate: Fri Aug 22 23:50:11 2025 +0530
WIP test fix for MockitoException
fixes local integration test failures, in, e.g. InterestPeriodTest and RepaymentPeriodTest, like this:
```text
initializationError
org.mockito.exceptions.base.MockitoException:
For org.apache.fineract.organisation.monetary.domain.MoneyHelper, static mocking is already registered in the current thread
To create a new mock, the existing static mock registration must be deregistered
at app//org.apache.fineract.portfolio.loanproduct.calc.data.RepaymentPeriodTest.init(RepaymentPeriodTest.java:53)
at java.base@21.0.7/java.lang.reflect.Method.invoke(Method.java:580)
at java.base@21.0.7/java.util.ArrayList.forEach(Unknown Source)
```
⚠️ only appears to be breaking for me when I run some or all integration tests locally ⚠️
see https://lists.apache.org/thread/tk29hd7ojxmbf3vmvj61b5g9zfg2v4y3
also see @adamsaghy's https://github.com/apache/fineract/pull/4975
---
.../portfolio/loanproduct/calc/data/InterestPeriodTest.java | 9 ++++-----
.../portfolio/loanproduct/calc/data/RepaymentPeriodTest.java | 8 ++++----
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriodTest.java b/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriodTest.java
index 68c67b4d7a..d2df95175a 100644
--- a/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriodTest.java
+++ b/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriodTest.java
@@ -46,13 +46,12 @@ class InterestPeriodTest {
private static final CurrencyData USD = new CurrencyData("USD", "US Dollar", 2, 1, "$", "USD");
private static final Money ZERO = Money.of(USD, BigDecimal.ZERO, MC);
- private static MockedStatic<MoneyHelper> moneyHelper;
-
@BeforeAll
static void init() {
- moneyHelper = Mockito.mockStatic(MoneyHelper.class);
- moneyHelper.when(MoneyHelper::getRoundingMode).thenReturn(RoundingMode.HALF_EVEN);
- moneyHelper.when(MoneyHelper::getMathContext).thenReturn(MC);
+ try (MockedStatic<MoneyHelper> moneyHelper = Mockito.mockStatic(MoneyHelper.class)) {
+ moneyHelper.when(MoneyHelper::getRoundingMode).thenReturn(RoundingMode.HALF_EVEN);
+ moneyHelper.when(MoneyHelper::getMathContext).thenReturn(MC);
+ }
}
@Test
diff --git a/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriodTest.java b/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriodTest.java
index f7e05cc516..105a4e6e06 100644
--- a/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriodTest.java
+++ b/fineract-progressive-loan/src/test/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriodTest.java
@@ -45,14 +45,14 @@ class RepaymentPeriodTest {
private static final CurrencyData USD = new CurrencyData("USD", "US Dollar", 2, 1, "$", "USD");
private static final Money ZERO = Money.of(USD, BigDecimal.ZERO, MC);
- private static MockedStatic<MoneyHelper> moneyHelper;
private static LoanProductMinimumRepaymentScheduleRelatedDetail loanProductRelatedDetail;
@BeforeAll
static void init() {
- moneyHelper = Mockito.mockStatic(MoneyHelper.class);
- moneyHelper.when(MoneyHelper::getRoundingMode).thenReturn(RoundingMode.HALF_EVEN);
- moneyHelper.when(MoneyHelper::getMathContext).thenReturn(MC);
+ try (MockedStatic<MoneyHelper> moneyHelper = Mockito.mockStatic(MoneyHelper.class)) {
+ moneyHelper.when(MoneyHelper::getRoundingMode).thenReturn(RoundingMode.HALF_EVEN);
+ moneyHelper.when(MoneyHelper::getMathContext).thenReturn(MC);
+ }
loanProductRelatedDetail = mock(LoanProductMinimumRepaymentScheduleRelatedDetail.class);
when(loanProductRelatedDetail.getCurrencyData()).thenReturn(USD);
(fineract) 01/03: WIP use gradle to aggregate (non-e2e) test results
Posted by me...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
meonkeys pushed a commit to branch auto-close-static-mocks
in repository https://gitbox.apache.org/repos/asf/fineract.git
commit a2880413dea981f18f37ff7bf8fcd6cbb69f7bf1
Author: Adam Monsen <ha...@gmail.com>
AuthorDate: Tue Aug 5 12:17:32 2025 -0700
WIP use gradle to aggregate (non-e2e) test results
Usage:
* run tests from one or more projects
* do not `gradle clean` between test runs
* run: `gradle testAggregateTestReport -x test`
* view report at `test-results/build/reports/tests/unit-test/aggregated-results/index.html`
Also... maybe we should be using Allure instead?
---
build.gradle | 3 +-
settings.gradle | 1 +
test-results/build.gradle | 74 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/build.gradle b/build.gradle
index cc02b39945..058625f7c2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -49,7 +49,8 @@ buildscript {
'fineract-e2e-tests-core',
'fineract-e2e-tests-runner',
'fineract-progressive-loan',
- 'fineract-progressive-loan-embeddable-schedule-generator'
+ 'fineract-progressive-loan-embeddable-schedule-generator',
+ 'test-results'
].contains(it.name)
}
fineractPublishProjects = subprojects.findAll{
diff --git a/settings.gradle b/settings.gradle
index de7530c1a1..607d507d08 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -75,6 +75,7 @@ include 'fineract-progressive-loan'
include 'fineract-progressive-loan-embeddable-schedule-generator'
// NOTE: custom Docker image with all custom modules included
include ':custom:docker'
+include ':test-results'
// NOTE: dynamically load custom modules with pattern "custom -> company -> category -> module"
file("${rootDir}/custom").eachDir { companyDir ->
if('build' != companyDir.name && 'docker' != companyDir.name) {
diff --git a/test-results/build.gradle b/test-results/build.gradle
new file mode 100644
index 0000000000..7919c15837
--- /dev/null
+++ b/test-results/build.gradle
@@ -0,0 +1,74 @@
+/**
+ * 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
+ *
+ * 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.
+ */
+
+//apply plugin: 'test-report-aggregation'
+
+plugins {
+ id 'test-report-aggregation'
+}
+
+description = 'Aggregate Test Results'
+
+// Declare dependencies using the testReportAggregation configuration
+// (list project results to aggregate here)
+dependencies {
+ // EVERYTHING. Doesn't work because we don't/can't run them all at once.
+ //testReportAggregation fineractJavaProjects
+
+ // FIXME - old project? delete?
+ //testReportAggregation project(':fineract-api')
+
+ // specific projects only (all but e2e) -- this is probably the way to go
+ testReportAggregation project(':fineract-core')
+ testReportAggregation project(':fineract-cob')
+ testReportAggregation project(':fineract-validation')
+ testReportAggregation project(':fineract-command')
+ testReportAggregation project(':fineract-accounting')
+ testReportAggregation project(':fineract-provider')
+ testReportAggregation project(':fineract-branch')
+ testReportAggregation project(':fineract-document')
+ testReportAggregation project(':fineract-investor')
+ testReportAggregation project(':fineract-charge')
+ testReportAggregation project(':fineract-rates')
+ testReportAggregation project(':fineract-tax')
+ testReportAggregation project(':fineract-loan')
+ testReportAggregation project(':fineract-savings')
+ testReportAggregation project(':fineract-report')
+ testReportAggregation project(':integration-tests')
+ testReportAggregation project(':twofactor-tests')
+ testReportAggregation project(':oauth2-tests')
+ testReportAggregation project(':fineract-client')
+ testReportAggregation project(':fineract-avro-schemas')
+ testReportAggregation project(':fineract-progressive-loan')
+ testReportAggregation project(':fineract-progressive-loan-embeddable-schedule-generator')
+}
+
+// Define a report of type AggregateTestReport which collects test data from unit test suites
+reporting {
+ reports {
+ testAggregateTestReport(AggregateTestReport) {
+ testType = TestSuiteType.UNIT_TEST
+ }
+ }
+}
+
+// make aggregate test report generation part of the 'check' lifecycle phase
+//tasks.named('check') {
+// dependsOn tasks.named('testAggregateTestReport', TestReport)
+//}