Skip to content

CARDS-2131: Increase test coverage cards-permissions - #1417

Open
sofi2002sofi wants to merge 2 commits into
devfrom
CARDS-2131-permissions-test
Open

CARDS-2131: Increase test coverage cards-permissions#1417
sofi2002sofi wants to merge 2 commits into
devfrom
CARDS-2131-permissions-test

Conversation

@sofi2002sofi

Copy link
Copy Markdown
Contributor

No description provided.

@Test
public void matchesForTreeWithoutResourceTypePropertyReturnsFalse()
{
NodeBuilderTree tree = new NodeBuilderTree(UUID.randomUUID().toString(), EmptyNodeState.EMPTY_NODE.builder());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed test case of tree created from sling:resourceType other than cards/Form

@Test
public void matchesForTreeWithoutResourceSuperTypePropertyReturnsFalse()
{
NodeBuilderTree tree = new NodeBuilderTree(UUID.randomUUID().toString(), EmptyNodeState.EMPTY_NODE.builder());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed test case of tree created from sling:resourceType other than cards/Answer

@Test
public void matchesForTreeWithoutResourceSuperTypePropertyReturnsFalse()
{
NodeBuilderTree tree = new NodeBuilderTree(UUID.randomUUID().toString(), EmptyNodeState.EMPTY_NODE.builder());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed test case of tree created from sling:resourceType other than cards/AnswerSection

@veronikaslc

Copy link
Copy Markdown
Contributor

PermissionsManagerServiceTest - > not covered cases from line 175 of PermissionsManagerService:

if (!restrictions.containsKey(key) || !entry.getRestriction(key).equals(restrictions.get(key)))

@veronikaslc

Copy link
Copy Markdown
Contributor

SessionSubjectRestrictionPatternTest -> 2 of 4 branches missed for line 99 of SessionSubjectRestrictionPattern.

@veronikaslc

Copy link
Copy Markdown
Contributor

jacoco.zip
jacoco:report html file attached

@sofi2002sofi
sofi2002sofi force-pushed the CARDS-2131-permissions-test branch from 7433108 to 0912d65 Compare August 26, 2023 17:23
@sdumitriu
sdumitriu force-pushed the CARDS-2131-permissions-test branch from 0912d65 to ef9b731 Compare August 26, 2023 21:54
@veronikaslc
veronikaslc force-pushed the CARDS-2131-permissions-test branch from ba0bf6f to 553181e Compare December 4, 2025 21:11
sofi2002sofi and others added 2 commits July 27, 2026 20:05
Modernize the revived tests and complete the module coverage to 100%:
- migrate the tests to the current platform APIs: the Jakarta servlet
  request built through the public Builders API, Mockito 5, sling-mock 4
- drop the Mockito runner in favor of plain mocks with reflection
  injection, since concurrently running runners collide on Mockito's
  global listener registry under the parallel surefire configuration
- remove the redundant osgi.cmpn dependency: it bundles an old copy of
  org.osgi.util.converter that shadows the one needed by the scripting
  BindingsValuesProvider tracker, breaking every Oak-backed test context
- raise the sling-mock resource resolver factory timeout, the default
  500ms is not always enough when several Oak-backed contexts start in
  parallel
- cover the previously untested paths: non-matching restriction targets,
  restriction comparison when removing an entry with restrictions,
  mismatched rule/principal/restriction removal attempts, forms without
  a subject, subjects with no matching ancestor, missing thread resource
  resolvers in the restriction factories
- drop the meaningless constructor smoke tests and rename the
  remaining vague test names
- remove the module's coverage exemption, restoring the default 1.00
  required instruction coverage ratio
@sdumitriu
sdumitriu force-pushed the CARDS-2131-permissions-test branch from 553181e to a62525d Compare July 27, 2026 20:37
}

@Test
public void getPatternForOakPathAndNotEmptyRestrictionsSetReturnsAnswerRestrictionPattern()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants