mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
added tests
This commit is contained in:
parent
c9dc7b9899
commit
b070f4069f
@ -20,6 +20,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.mysema.query.types.ConstantImpl;
|
||||
import com.mysema.query.types.Expression;
|
||||
import com.mysema.query.types.NullExpression;
|
||||
import com.mysema.query.types.Operator;
|
||||
import com.mysema.query.types.Ops;
|
||||
|
||||
@ -91,6 +92,10 @@ public final class CaseForEqBuilder<D> {
|
||||
public <T> Cases<T,Expression<T>> then(T then){
|
||||
return then(new ConstantImpl<T>(then));
|
||||
}
|
||||
|
||||
public <T> Cases<T,Expression<T>> thenNull() {
|
||||
return then((Expression<T>)NullExpression.DEFAULT);
|
||||
}
|
||||
|
||||
public <T extends Number & Comparable<?>> Cases<T,NumberExpression<T>> then(T then){
|
||||
return thenNumber(new ConstantImpl<T>(then));
|
||||
|
||||
@ -86,4 +86,5 @@ public class CoalesceTest {
|
||||
public void Desc() {
|
||||
assertEquals("coalesce(firstname, xxx) DESC", firstname.coalesce("xxx").desc().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -54,6 +54,13 @@ public class SimpleExpressionTest {
|
||||
assertEquals("str as alias", str.as("alias").toString());
|
||||
assertEquals("str as alias", str.as(new StringPath("alias")).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Case() {
|
||||
SimpleExpression<String> str = new StringPath("str");
|
||||
// nullif(str, 'xxx')
|
||||
str.when("xxx").thenNull().otherwise(str);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Subclasses_Override_As() throws SecurityException, NoSuchMethodException{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user