Skip to content

Commit 050da72

Browse files
committed
HHH-18783 test for trailing space handling in cast()
Signed-off-by: Gavin King <[email protected]>
1 parent 4fbade6 commit 050da72

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,9 +1139,18 @@ public void testCastFunctionWithLength(SessionFactoryScope scope) {
11391139
assertEquals( 'A',
11401140
session.createQuery("select cast('ABCDEF' as Character)", Character.class)
11411141
.getSingleResult() );
1142+
assertEquals( ' ',
1143+
session.createQuery("select cast(' X ' as Character)", Character.class)
1144+
.getSingleResult() );
11421145
assertEquals( "ABC",
11431146
session.createQuery("select cast('ABCDEF' as String(3))", String.class)
11441147
.getSingleResult() );
1148+
assertEquals( "ABC",
1149+
session.createQuery("select cast('ABC' as String(6))", String.class)
1150+
.getSingleResult() );
1151+
assertEquals( "ABC ",
1152+
session.createQuery("select cast('ABC DEF' as String(4))", String.class)
1153+
.getSingleResult() );
11451154
}
11461155
);
11471156
}

0 commit comments

Comments
 (0)