extra test for 'is distinct from'

This commit is contained in:
Gavin King 2023-06-25 20:06:07 +02:00
parent b7120a60a3
commit 1807e1cc43
1 changed files with 17 additions and 0 deletions

View File

@ -19,6 +19,8 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author Christian Beikov
*/
@ -115,4 +117,19 @@ public class DistinctFromTest {
);
}
@Test void testNulls(SessionFactoryScope scope) {
scope.inSession(session -> {
assertEquals(1, session.createSelectionQuery("select 1 where 1 is distinct from 0").getResultList().size());
assertEquals(0, session.createSelectionQuery("select 1 where 1 is distinct from 1").getResultList().size());
assertEquals(1, session.createSelectionQuery("select 1 where null is distinct from 1").getResultList().size());
assertEquals(1, session.createSelectionQuery("select 1 where null is distinct from 0").getResultList().size());
assertEquals(0, session.createSelectionQuery("select 1 where null is distinct from null").getResultList().size());
assertEquals(0, session.createSelectionQuery("select 1 where 1 is not distinct from 0").getResultList().size());
assertEquals(1, session.createSelectionQuery("select 1 where 1 is not distinct from 1").getResultList().size());
assertEquals(0, session.createSelectionQuery("select 1 where null is not distinct from 1").getResultList().size());
assertEquals(0, session.createSelectionQuery("select 1 where null is not distinct from 0").getResultList().size());
assertEquals(1, session.createSelectionQuery("select 1 where null is not distinct from null").getResultList().size());
});
}
}