-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement
Milestone
Description
Suppose we have this code in production:
private boolean isExternalProfileEnabled() {
return environment.acceptsProfiles(Profiles.of("external"));
}Then I want to mock this in tests and I write something like:
when(environment.acceptsProfiles(Profiles.of("external"))).thenReturn(true);And at runtime the mock fails to return true, because comparison of arguments fails due to missing equals() and hashCode() implementations in ParsedProfiles.
This makes us use the deprecated API and rewrite the example code like:
private boolean isExternalProfileEnabled() {
return environment.acceptsProfiles("external");
}and use of the deprecated API in turn makes Sonar unhappy.
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement