From 050da72ae92bb3bf423d17f7a9375015137ea3d1 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Mon, 4 Nov 2024 17:41:12 +0100 Subject: [PATCH] HHH-18783 test for trailing space handling in cast() Signed-off-by: Gavin King --- .../org/hibernate/orm/test/query/hql/FunctionTests.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java index d954d30936..f0aa28a40c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java @@ -1139,9 +1139,18 @@ public class FunctionTests { assertEquals( 'A', session.createQuery("select cast('ABCDEF' as Character)", Character.class) .getSingleResult() ); + assertEquals( ' ', + session.createQuery("select cast(' X ' as Character)", Character.class) + .getSingleResult() ); assertEquals( "ABC", session.createQuery("select cast('ABCDEF' as String(3))", String.class) .getSingleResult() ); + assertEquals( "ABC", + session.createQuery("select cast('ABC' as String(6))", String.class) + .getSingleResult() ); + assertEquals( "ABC ", + session.createQuery("select cast('ABC DEF' as String(4))", String.class) + .getSingleResult() ); } ); }