-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finished setting up test that reproduces the issue
- Loading branch information
Showing
2 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
42 changes: 41 additions & 1 deletion
42
...sl/src/test/java/com/infobip/spring/data/r2dbc/mysql/MysqlNamedParametersSupportTest.java
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 |
---|---|---|
@@ -1,18 +1,58 @@ | ||
package com.infobip.spring.data.r2dbc.mysql; | ||
|
||
import com.infobip.spring.data.r2dbc.TestBase; | ||
import com.infobip.spring.data.r2dbc.*; | ||
import lombok.AllArgsConstructor; | ||
import org.assertj.core.api.BDDAssertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.test.context.*; | ||
import reactor.core.publisher.Mono; | ||
import reactor.test.StepVerifier; | ||
|
||
import java.util.function.Predicate; | ||
|
||
import static com.infobip.spring.data.r2dbc.QPerson.person; | ||
|
||
@AllArgsConstructor | ||
@ContextConfiguration(loader = MssqlExclusionContextLoader.class) | ||
@ActiveProfiles("mysql") | ||
@TestConstructor(autowireMode = TestConstructor.AutowireMode.ALL) | ||
public class MysqlNamedParametersSupportTest extends TestBase { | ||
|
||
private final PersonRepository repository; | ||
|
||
@Test | ||
void shouldNotFail() { | ||
// given | ||
var given = given(givenSavedPerson("John", "Doe"), | ||
givenSavedPerson("Johny", "Roe"), | ||
givenSavedPerson("Jane", "Doe"), | ||
givenSavedPerson("John", "Roe"), | ||
givenSavedPerson("Janie", "Doe")); | ||
|
||
// when | ||
var actual = given.thenMany(repository.query(query -> query.select(repository.entityProjection()) | ||
.from(person) | ||
.where(person.firstName.in("John", "Jane")) | ||
.orderBy(person.firstName.asc(), | ||
person.lastName.asc()) | ||
.limit(1) | ||
.offset(1)) | ||
.all()); | ||
|
||
// then | ||
StepVerifier.create(actual) | ||
.expectNextMatches(person("John", "Doe")) | ||
.verifyComplete(); | ||
} | ||
|
||
private Mono<Person> givenSavedPerson(String firstName, String lastName) { | ||
return repository.save(new Person(null, firstName, lastName)); | ||
} | ||
|
||
private Predicate<? super Person> person(String firstName, String lastName) { | ||
return person -> { | ||
BDDAssertions.then(person).isEqualTo(new Person(person.id(), firstName, lastName)); | ||
return true; | ||
}; | ||
} | ||
} |
12 changes: 6 additions & 6 deletions
12
...-spring-data-r2dbc-querydsl/src/test/resources/db/migration/mysql/V1_0_0__base_schema.sql
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