Skip to content

Commit bbd4fb4

Browse files
committed
test: add unit tests for QueryProjectionBuilder
1 parent 7a8a09f commit bbd4fb4

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.querydsl.apt.domain;
2+
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertNotNull;
5+
6+
import com.querydsl.core.types.dsl.Expressions;
7+
import org.junit.Test;
8+
9+
public class QueryProjectionBuilderTest {
10+
11+
@Test
12+
public void builder_buildsQClassCorrectly() {
13+
var property = Expressions.stringPath("x");
14+
QQueryProjectionBuilderTestEntity dto =
15+
QQueryProjectionBuilderTestEntity.builderTest1().setProperty(property).build();
16+
17+
assertNotNull(dto);
18+
assertEquals(QueryProjectionBuilderTestEntity.class, dto.getType());
19+
}
20+
21+
@Test
22+
public void builder_buildsQClassCorrectly2() {
23+
var property = Expressions.stringPath("x");
24+
var intProperty = Expressions.numberPath(Integer.class, "y");
25+
QQueryProjectionBuilderTestEntity dto =
26+
QQueryProjectionBuilderTestEntity.builderTest2()
27+
.setProperty(property)
28+
.setIntProperty(intProperty)
29+
.build();
30+
31+
assertNotNull(dto);
32+
assertEquals(QueryProjectionBuilderTestEntity.class, dto.getType());
33+
}
34+
}

0 commit comments

Comments
 (0)