-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: TAG and TEXT fields should be escaped by default when using QBE (r…
…esolved gh-451)
- Loading branch information
Showing
3 changed files
with
52 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,8 @@ | |
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; | ||
import static org.junit.jupiter.api.Assertions.assertAll; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class RedisDocumentQueryByExampleTest extends AbstractBaseDocumentTest { | ||
@Autowired | ||
|
@@ -542,4 +543,28 @@ void testFindByShouldApplyProjection() { | |
assertThat(doc1.getANumber()).isNotNull(); | ||
assertThat(doc1.getTitle()).isNull(); | ||
} | ||
|
||
@Test | ||
void testTagEscapeCharsWithProjection() { | ||
Company template = new Company(); | ||
template.setEmail("[email protected]"); | ||
|
||
Example<Company> example = Example.of(template); | ||
|
||
Company result = companyRepository.findBy(example, it -> it.project("name").firstValue()); | ||
|
||
assertThat(result.getName()).isEqualTo("RedisInc"); | ||
} | ||
|
||
@Test | ||
void testTagEscapeCharsFindByShouldReturnOneResult() { | ||
Company template = new Company(); | ||
template.setEmail("[email protected]"); | ||
|
||
Example<Company> example = Example.of(template); | ||
|
||
Company result = companyRepository.findBy(example, FetchableFluentQuery::oneValue); | ||
assertThat(result).isNotNull().hasFieldOrPropertyWithValue("email", "[email protected]"); | ||
assertThat(result.getName()).isEqualTo("RedisInc"); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -454,4 +454,28 @@ void testFindByShouldApplyProjection() { | |
assertThat(doc1.getTitle()).isNull(); | ||
} | ||
|
||
@Test | ||
void testTagEscapeCharsWithProjection() { | ||
Company template = new Company(); | ||
template.setEmail("[email protected]"); | ||
|
||
Example<Company> example = Example.of(template); | ||
|
||
Company result = companyRepository.findBy(example, it -> it.project("name").firstValue()); | ||
|
||
assertThat(result.getName()).isEqualTo("RedisInc"); | ||
} | ||
|
||
@Test | ||
void testTagEscapeCharsFindByShouldReturnOneResult() { | ||
Company template = new Company(); | ||
template.setEmail("[email protected]"); | ||
|
||
Example<Company> example = Example.of(template); | ||
|
||
Company result = companyRepository.findBy(example, FetchableFluentQuery::oneValue); | ||
assertThat(result).isNotNull().hasFieldOrPropertyWithValue("email", "[email protected]"); | ||
assertThat(result.getName()).isEqualTo("RedisInc"); | ||
} | ||
|
||
} |