add tests for avg(index) and avg(element)

This commit is contained in:
Gavin King 2022-02-07 13:41:05 +01:00
parent 3b221b7b18
commit 52c7f61815
1 changed files with 15 additions and 0 deletions

View File

@ -108,6 +108,16 @@ public class FunctionTests {
// .getSingleResult(),
is(3.0) );
//TODO: why does this fail??
// assertThat( session.createQuery("select avg(index eol.listOfNumbers) from EntityOfLists eol")
// .list().get(0),
//// .getSingleResult(),
// is(0.5) );
assertThat( session.createQuery("select avg(element eol.listOfNumbers) from EntityOfLists eol")
.list().get(0),
// .getSingleResult(),
is(1.5) );
assertThat( session.createQuery("select max(index eom.numberByNumber) from EntityOfMaps eom")
.getSingleResult(), is(1) );
assertThat( session.createQuery("select max(element eom.numberByNumber) from EntityOfMaps eom")
@ -117,6 +127,11 @@ public class FunctionTests {
.getSingleResult(), is(1) );
assertThat( session.createQuery("select sum(element eom.numberByNumber) from EntityOfMaps eom")
.getSingleResult(), is(1.0) );
assertThat( session.createQuery("select avg(index eom.numberByNumber) from EntityOfMaps eom")
.getSingleResult(), is(1) );
assertThat( session.createQuery("select avg(element eom.numberByNumber) from EntityOfMaps eom")
.getSingleResult(), is(1.0) );
}
);
}