File tree Expand file tree Collapse file tree
src/test/java/com/github/collinalpert/lambda2sql Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ You can include the Maven dependency:
5656<dependency >
5757 <groupId >com.github.collinalpert</groupId >
5858 <artifactId >lambda2sql</artifactId >
59- <version >1.6.2 </version >
59+ <version >1.6.3 </version >
6060</dependency >
6161```
6262
Original file line number Diff line number Diff line change 66
77 <groupId >com.github.collinalpert</groupId >
88 <artifactId >lambda2sql</artifactId >
9- <version >1.6.2 </version >
9+ <version >1.6.3 </version >
1010 <packaging >jar</packaging >
1111
1212 <name >lambda2sql</name >
4848 <dependency >
4949 <groupId >com.trigersoft</groupId >
5050 <artifactId >jaque</artifactId >
51- <version >2.2.0 </version >
51+ <version >2.2.1 </version >
5252 </dependency >
5353
5454 <dependency >
Original file line number Diff line number Diff line change 22
33import com .github .collinalpert .lambda2sql .functions .SqlFunction ;
44import com .github .collinalpert .lambda2sql .functions .SqlPredicate ;
5+ import com .trigersoft .jaque .expression .LambdaExpression ;
56import org .junit .jupiter .api .Assertions ;
67import org .junit .jupiter .api .Test ;
78
@@ -43,6 +44,21 @@ void testFunction() {
4344 assertFunctionEqual ("age" , person -> person .getAge ());
4445 }
4546
47+ @ Test
48+ void testMethodReferences () {
49+ SqlPredicate <Person > person = Person ::isAdult ;
50+ SqlPredicate <Person > personAnd = person .and (x -> true );
51+ LambdaExpression <SqlPredicate <Person >> lambda = LambdaExpression .parse (personAnd );
52+ }
53+
54+ @ Test
55+ void testGetById () {
56+ int id = 1 ;
57+ SqlPredicate <Person > personPredicate = person -> person .getId () == id ;
58+ SqlPredicate <Person > personSqlPredicateAnd = personPredicate .and (x -> true );
59+ LambdaExpression <SqlPredicate <Person >> pred = LambdaExpression .parse (personSqlPredicateAnd );
60+ }
61+
4662 private void assertPredicateEqual (String expectedSql , SqlPredicate <Person > p ) {
4763 var sql = Lambda2Sql .toSql (p , "person" );
4864 Assertions .assertEquals (expectedSql , sql );
Original file line number Diff line number Diff line change 11package com .github .collinalpert .lambda2sql ;
22
33public interface Person {
4+ long getId ();
5+
46 String getName ();
57
68 int getAge ();
79
810 int getHeight ();
911
1012 boolean isActive ();
13+
14+ default boolean isAdult () {
15+ return getAge () >= 18 ;
16+ }
1117}
You can’t perform that action at this time.
0 commit comments