mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-06 21:05:50 +08:00
Add test #520
This commit is contained in:
parent
f71b034034
commit
7914420aca
@ -101,6 +101,7 @@ import com.mysema.query.types.expr.BooleanExpression;
|
||||
import com.mysema.query.types.expr.ListExpression;
|
||||
import com.mysema.query.types.expr.Param;
|
||||
import com.mysema.query.types.expr.SimpleExpression;
|
||||
import com.mysema.query.types.expr.StringExpression;
|
||||
import com.mysema.query.types.path.EnumPath;
|
||||
import com.mysema.query.types.path.ListPath;
|
||||
import com.mysema.query.types.path.NumberPath;
|
||||
@ -205,6 +206,7 @@ public abstract class AbstractJPATest {
|
||||
save(show);
|
||||
|
||||
Company company = new Company();
|
||||
company.name = "1234567890123456789012345678901234567890"; // 40
|
||||
company.id = 1;
|
||||
company.ratingOrdinal = Company.Rating.A;
|
||||
company.ratingString = Company.Rating.AA;
|
||||
@ -1137,6 +1139,29 @@ public abstract class AbstractJPATest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Substring2() {
|
||||
QCompany company = QCompany.company;
|
||||
StringExpression name = company.name;
|
||||
JPQLQuery query = query().from(company);
|
||||
String str = query.singleResult(company.name);
|
||||
|
||||
assertEquals(Integer.valueOf(29),
|
||||
query.singleResult(name.length().subtract(11)));
|
||||
|
||||
assertEquals(str.substring(0, 7),
|
||||
query.singleResult(name.substring(0, 7)));
|
||||
|
||||
assertEquals(str.substring(15),
|
||||
query.singleResult(name.substring(15)));
|
||||
|
||||
assertEquals(str.substring(str.length()),
|
||||
query.singleResult(name.substring(name.length())));
|
||||
|
||||
assertEquals(str.substring(str.length() - 11),
|
||||
query.singleResult(name.substring(name.length().subtract(11))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ExcludeIn(DERBY)
|
||||
public void Substring_From_Right() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user