forked from spring-projects/spring-framework
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Profiles created via Profiles.of() comparable
Prior to this commit, a Profiles instance created via Profiles.of() was not considered equivalent to another Profiles instance created via Profiles.of() with the exact same expressions. This makes it difficult to mock invocations of Environment#acceptsProfiles(Profiles) -- for example, when using a mocking library such as Mockito. This commit makes Profiles instances created via Profiles.of() "comparable" by implementing equals() and hashCode() in ParsedProfiles. Note, however, that equivalence is only guaranteed if the exact same profile expression strings are supplied to Profiles.of(). In other words, Profiles.of("A & B", "C | D") is equivalent to Profiles.of("A & B", "C | D") and Profiles.of("C | D", "A & B"), but Profiles.of("X & Y") is not equivalent to Profiles.of("X&Y") or Profiles.of("Y & X"). Closes spring-projectsgh-25340
- Loading branch information
Showing
3 changed files
with
106 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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