CARDS-2158: data-entry tests - #1455
Draft
sofi2002sofi wants to merge 2 commits into
Draft
Conversation
Contributor
|
Rebased on `[ERROR] QueryBuilderTest.initForFullTextQuery:277 expected:<0> but was:<-1> [ERROR] QueryBuilderTest.initForLuceneQuery:311 expected:<0> but was:<-1> [ERROR] QueryBuilderTest.initForQuickQuerySelectsForms:240 expected:<0> but was:<-1>` |
sofi2002sofi
force-pushed
the
CARDS-2158-dataentry-test
branch
from
June 21, 2023 21:28
1f75013 to
0a7ebdb
Compare
veronikaslc
force-pushed
the
CARDS-2158-dataentry-test
branch
2 times, most recently
from
December 6, 2025 06:40
d464df9 to
8e3b7d5
Compare
Co-Authored-By: Michael Lescisin <michael.lescisin@uhn.ca> Co-Authored-By: veronikaslc <veronika.koltunov@gmail.com>
Bring the revived tests onto the current platform, as far as they compile
and run. This is an intermediate state: the suite builds and runs, but 31
of the 80 tests still fail. It is committed so the migration work is not
lost; see the notes at the end for what remains.
Done:
- migrate the tests to the current platform APIs: jakarta.json,
jakarta.servlet, the Sling Jakarta request/response mocks, Mockito 5
(org.mockito.runners.MockitoJUnitRunner and org.mockito.Matchers are
both long gone), sling-mock 4.0.6 / sling-mock-oak 4.1.0-1.86.0 /
jcr-mock 1.8.2
- drop the Mockito runner in favor of plain instantiation and plain
mock() fields, since concurrently running runners collide on Mockito's
global listener registry under the parallel surefire configuration
- raise the sling-mock resource resolver factory timeout, the default
500ms is not always enough when several Oak-backed test contexts start
in parallel
- delete the aggregated-cnd module: it was a byte-for-byte copy of the
data entry module's own dataentry.cnd, except for a corrupted sling
namespace URI ("http://sling.apache.org/jcr/sling/1.Bac0"), and it only
existed to give the tests a jar whose manifest declares the node types.
Node types should be registered from the real CND instead.
- delete DateUtilsTest: the io.uhndata.cards.DateUtils class it covers no
longer exists, and the method it tested, getTimezoneForDateString, is
gone from the codebase entirely
- drop the guava and assertj test dependencies, the obsolete -Werror
compiler configuration, and a rat exclusion for two theme files that
were deleted in the meantime
- remove the module's coverage exemption, restoring the default 1.00
required instruction coverage ratio
Still failing, all because main code moved on since the branch was
written (December 2025), none of them yet diagnosed to a fix:
- PaginationServletTest, 10: the servlet writes an empty body, because
Filter now normalizes date values through DateUtils.normalize, which
returns null for the very format PaginationServlet's own javadoc
documents for date filters ("2020-12-31T00:00-04:00"): DATETIME_FORMATS
has no offset pattern without seconds. Either DateUtils gains that
format or the tests stop using it, but note that doGet swallows the
resulting exception and returns a 200 with no body at all.
- DataImportServletTest, 12: the tests navigate to a form's answers
positionally and now land on the cards:links child that newer main code
adds.
- CountServletTest, 5; QueryBuilderTest, 2; ResourceIteratorTest, 1.
- DeleteServletTest, 1: DeleteServlet.sendJsonError NPEs writing a null
message when the RepositoryException carries none. This one looks like
a genuine main code bug rather than a stale test.
Coverage has not been extended to 100% yet either; that is the other half
of the remaining work.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sdumitriu
force-pushed
the
CARDS-2158-dataentry-test
branch
from
July 28, 2026 02:43
8e3b7d5 to
d07d015
Compare
| JsonObject responseJson = getResponseJsonReader(response); | ||
| assertTrue(responseJson.containsKey(ROWS_PROPERTY)); | ||
| assertTrue(responseJson.get(ROWS_PROPERTY) instanceof JsonArray); | ||
| JsonArray rows = responseJson.getJsonArray(ROWS_PROPERTY); |
| JsonObject responseJson = getResponseJsonReader(response); | ||
| assertTrue(responseJson.containsKey(ROWS_PROPERTY)); | ||
| assertTrue(responseJson.get(ROWS_PROPERTY) instanceof JsonArray); | ||
| JsonArray rows = responseJson.getJsonArray(ROWS_PROPERTY); |
| JsonObject responseJson = getResponseJsonReader(response); | ||
| assertTrue(responseJson.containsKey(ROWS_PROPERTY)); | ||
| assertTrue(responseJson.get(ROWS_PROPERTY) instanceof JsonArray); | ||
| JsonArray rows = responseJson.getJsonArray(ROWS_PROPERTY); |
| return this.context.resourceResolver().adaptTo(Session.class).getNodeByIdentifier(identifier).getPath(); | ||
| } | ||
|
|
||
| private MockSlingJakartaHttpServletRequest mockServletRequest(String resourcePath, boolean isRecursive) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.