Skip to content

Commit dd9dfef

Browse files
authored
Merge pull request #635 from m-dzianishchyts/CAY-2860-exp-in-empty
CAY-2860 Translate (not)in expression with empty values
2 parents 4702c36 + 6330e1c commit dd9dfef

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

cayenne/src/test/java/org/apache/cayenne/exp/ExpressionIT.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.apache.cayenne.di.Inject;
2626
import org.apache.cayenne.exp.parser.ASTIn;
2727
import org.apache.cayenne.exp.parser.ASTList;
28+
import org.apache.cayenne.exp.parser.ASTNotIn;
2829
import org.apache.cayenne.exp.parser.SimpleNode;
2930
import org.apache.cayenne.query.ObjectSelect;
3031
import org.apache.cayenne.runtime.CayenneRuntime;
@@ -34,7 +35,6 @@
3435
import org.apache.cayenne.unit.di.runtime.CayenneProjects;
3536
import org.apache.cayenne.unit.di.runtime.RuntimeCase;
3637
import org.apache.cayenne.unit.di.runtime.UseCayenneRuntime;
37-
import org.junit.Ignore;
3838
import org.junit.Test;
3939

4040
import java.util.ArrayList;
@@ -173,7 +173,6 @@ public void testInEmpty() {
173173
}
174174

175175
@Test
176-
@Ignore("see https://issues.apache.org/jira/browse/CAY-2860")
177176
public void testExplicitInEmpty() {
178177
Artist a1 = context.newObject(Artist.class);
179178
a1.setArtistName("Picasso");
@@ -184,6 +183,18 @@ public void testExplicitInEmpty() {
184183
assertTrue(artists.isEmpty());
185184
}
186185

186+
@Test
187+
public void testExplicitNotInEmpty() {
188+
Artist a1 = context.newObject(Artist.class);
189+
a1.setArtistName("Picasso");
190+
context.commitChanges();
191+
192+
ASTNotIn notIn = new ASTNotIn((SimpleNode) Artist.ARTIST_NAME.getExpression(), new ASTList(List.of()));
193+
List<Artist> artists = ObjectSelect.query(Artist.class, notIn).select(context);
194+
assertEquals(1, artists.size());
195+
assertEquals("Picasso", artists.get(0).getArtistName());
196+
}
197+
187198
/**
188199
* We are waiting invalid SQL here:
189200
* data type of expression is not boolean in statement

0 commit comments

Comments
 (0)