Skip to content

Expose Collection<ModelAndView> on FragmentsRendering to facilitate Unit Tests #35775

@MalukuSeito

Description

@MalukuSeito

When writing Unit-Tests for my controllers, I noticed that the modelAndViews list of FragmentsRendering is not accessible anywhere, effectively preventing me from write Tests that ensure the right views have been added to the FragmentRendering. Furthermore, the way the Builder is invoked prevents effective mocking of the FragmentsRenderingBuilder. Leaving only reflection to access the content. There should be a better way:

FragmentsRendering fragments = adminController.deleteUser(authenticationMock, "mockid", httpServletRequestMock);
// asssertThat(fragments .getViews()).hasSize(2); // This does not work

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions