mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Unittest for select Query with (*,x(y))
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package io.ebean.text;
|
||||
|
||||
import io.ebean.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.FetchPath;
|
||||
import io.ebean.Query;
|
||||
import io.ebean.test.LoggedSql;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -14,7 +17,7 @@ import java.util.List;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class PathPropertiesTests {
|
||||
public class PathPropertiesTests extends BaseTestCase {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PathPropertiesTests.class);
|
||||
|
||||
@@ -212,4 +215,16 @@ public class PathPropertiesTests {
|
||||
String asJson = DB.json().toJson(list, pathProps);
|
||||
log.info("Json: {}", asJson);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_withAllPropsQuery() {
|
||||
PathProperties root = PathProperties.parse("*,billingAddress(line1)");
|
||||
LoggedSql.start();
|
||||
Query<Customer> query = DB.find(Customer.class).apply(root);
|
||||
query.findList();
|
||||
List<String> sql = LoggedSql.stop();
|
||||
assertThat(sql).hasSize(1);
|
||||
assertThat(sql.get(0)).contains("select t0.status, t0.name, t0.smallnote, t0.anniversary, t0.id, t1.id, t1.line_1 from o_customer t0 left join o_address t1 on t1.id = t0.billing_address_id");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user