Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Criteria or toEquals fail if contains regex [DATAMONGO-2559] #3414

Closed
spring-projects-issues opened this issue May 27, 2020 · 0 comments
Closed
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: bug A general bug

Comments

@spring-projects-issues
Copy link

Tera opened DATAMONGO-2559 and commented

Hi

I've found that Criteria object fails equality check if multiple regex criteria are chained into an "orOperator"

 

Here the test i wrote to verify (written in kotlin)

 

class TestCriteriaEquality {
    
    @Test
    fun testSingleRegExEquality() {
        val expected = Criteria("foo").regex("value", "i")
        val actual = Criteria("foo").regex("value", "i")               assertEquals(expected, actual)
    }

    @Test
    fun checkCriteriaOrRegExEquality() {
        val expected = Criteria("a").orOperator(
                Criteria("foo").regex("value", "i"),
                Criteria("bar").regex("value")
        )        val actual = Criteria("a").orOperator(
                Criteria("foo").regex("value", "i"),
                Criteria("bar").regex("value")
        )        Assert.assertEquals(expected, actual)
    }    

    @Test
    fun checkCriteriaOrIsEqualToEquality() {
        val expected = Criteria("a").orOperator(
                Criteria("foo").isEqualTo("value"),
                Criteria("bar").isEqualTo("value")
        )        val actual = Criteria("a").orOperator(
                Criteria("foo").isEqualTo("value"),
                Criteria("bar").isEqualTo("value")
        )        Assert.assertEquals(expected, actual)
    }
}

 

 


Affects: 2.2.7 (Moore SR7)

@spring-projects-issues spring-projects-issues added type: bug A general bug status: ideal-for-contribution An issue that a contributor can help us with labels Dec 30, 2020
petitcl added a commit to petitcl/spring-data-mongodb that referenced this issue Mar 29, 2021
petitcl added a commit to petitcl/spring-data-mongodb that referenced this issue Mar 30, 2021
petitcl added a commit to petitcl/spring-data-mongodb that referenced this issue Apr 8, 2021
@mp911de mp911de added this to the 3.0.9 (Neumann SR9) milestone Apr 13, 2021
mp911de added a commit that referenced this issue Apr 13, 2021
Fix nullability annotations for isEqual(…) parameters. Fix generics. Reformat code.

Add tests.

See #3414
Original pull request: #3615.
mp911de pushed a commit that referenced this issue Apr 13, 2021
mp911de added a commit that referenced this issue Apr 13, 2021
Fix nullability annotations for isEqual(…) parameters. Fix generics. Reformat code.

Add tests.

See #3414
Original pull request: #3615.
mp911de pushed a commit that referenced this issue Apr 13, 2021
mp911de added a commit that referenced this issue Apr 13, 2021
Fix nullability annotations for isEqual(…) parameters. Fix generics. Reformat code.

Add tests.

See #3414
Original pull request: #3615.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants