diff --git a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java index 01c6651c4399b..eb19fa2b42d4b 100644 --- a/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java +++ b/sdk/cosmos/azure-spring-data-cosmos-test/src/test/java/com/azure/spring/data/cosmos/core/CosmosTemplateIT.java @@ -573,6 +573,39 @@ public void testArrayContainsCriteria() { assertThat(people).containsExactly(TEST_PERSON); } + @Test + public void testIsNotNullCriteriaCaseSensitive() { + Criteria hasLastName = Criteria.getInstance(CriteriaType.IS_NOT_NULL, "lastName", + Collections.emptyList(), + Part.IgnoreCaseType.ALWAYS); + List people = TestUtils.toList(cosmosTemplate.find(new CosmosQuery(hasLastName), Person.class, + containerName)); + + assertThat(people).containsExactly(TEST_PERSON); + } + + @Test + public void testStartsWithCriteriaCaseSensitive() { + Criteria nameStartsWith = Criteria.getInstance(CriteriaType.STARTS_WITH, "firstName", + Collections.singletonList(TEST_PERSON.getFirstName().toUpperCase()), + Part.IgnoreCaseType.ALWAYS); + List people = TestUtils.toList(cosmosTemplate.find(new CosmosQuery(nameStartsWith), Person.class, + containerName)); + + assertThat(people).containsExactly(TEST_PERSON); + } + + @Test + public void testIsEqualCriteriaCaseSensitive() { + Criteria nameStartsWith = Criteria.getInstance(CriteriaType.IS_EQUAL, "firstName", + Collections.singletonList(TEST_PERSON.getFirstName().toUpperCase()), + Part.IgnoreCaseType.ALWAYS); + List people = TestUtils.toList(cosmosTemplate.find(new CosmosQuery(nameStartsWith), Person.class, + containerName)); + + assertThat(people).containsExactly(TEST_PERSON); + } + @Test public void testBetweenCriteria() { Criteria ageBetween = Criteria.getInstance(CriteriaType.BETWEEN, "age", Arrays.asList(AGE - 1, AGE + 1), diff --git a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/AbstractQueryGenerator.java b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/AbstractQueryGenerator.java index 80544c6f8cfef..0027706f1cb2a 100644 --- a/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/AbstractQueryGenerator.java +++ b/sdk/cosmos/azure-spring-data-cosmos/src/main/java/com/azure/spring/data/cosmos/core/generator/AbstractQueryGenerator.java @@ -64,7 +64,13 @@ private String generateBinaryQuery(@NonNull Criteria criteria, @NonNull List