|
20 | 20 | import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
21 | 21 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
22 | 22 | import static org.junit.jupiter.api.Assertions.assertNull;
|
| 23 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
23 | 24 | import static org.springframework.data.couchbase.util.Util.comprises;
|
24 | 25 | import static org.springframework.data.couchbase.util.Util.exactly;
|
25 | 26 |
|
|
29 | 30 | import java.util.Optional;
|
30 | 31 | import java.util.stream.StreamSupport;
|
31 | 32 |
|
| 33 | +import com.querydsl.core.types.dsl.PathBuilder; |
32 | 34 | import org.junit.jupiter.api.AfterAll;
|
33 | 35 | import org.junit.jupiter.api.BeforeAll;
|
34 | 36 | import org.junit.jupiter.api.BeforeEach;
|
|
43 | 45 | import org.springframework.data.couchbase.core.mapping.event.ValidatingCouchbaseEventListener;
|
44 | 46 | import org.springframework.data.couchbase.core.query.QueryCriteriaDefinition;
|
45 | 47 | import org.springframework.data.couchbase.domain.Airline;
|
| 48 | +import org.springframework.data.couchbase.domain.AirlineCollectioned; |
46 | 49 | import org.springframework.data.couchbase.domain.AirlineRepository;
|
47 | 50 | import org.springframework.data.couchbase.domain.QAirline;
|
| 51 | +import org.springframework.data.couchbase.domain.QAirlineCollectioned; |
48 | 52 | import org.springframework.data.couchbase.repository.auditing.EnableCouchbaseAuditing;
|
49 | 53 | import org.springframework.data.couchbase.repository.auditing.EnableReactiveCouchbaseAuditing;
|
50 | 54 | import org.springframework.data.couchbase.repository.config.EnableCouchbaseRepositories;
|
@@ -147,6 +151,13 @@ void testEq() {
|
147 | 151 | }
|
148 | 152 | }
|
149 | 153 |
|
| 154 | + @Test |
| 155 | + void testInjection() { |
| 156 | + String userSpecifiedPath = "1 = 1) OR (2"; |
| 157 | + PathBuilder<QAirline> pathBuilder = new PathBuilder<>(QAirline.class, "xyz"); |
| 158 | + assertThrows(IllegalStateException.class, () -> pathBuilder.get(userSpecifiedPath).eq("2")); |
| 159 | + } |
| 160 | + |
150 | 161 | // this gives hqCountry == "" and hqCountry is missing
|
151 | 162 | // @Test
|
152 | 163 | void testStringIsEmpty() {
|
|
0 commit comments