Hibernate ORM AnsiTrimEmulationFunction - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Hibernate ORM AnsiTrimEmulationFunction class.

This code example shows how to use the following methods:render
 */ 
public class AnsiTrimEmulationFunctionTest extends TestCase {
	private static final String trimSource = "a.column";
 
	public void testBasicSqlServerProcessing() { 
		AnsiTrimEmulationFunction function = new AnsiTrimEmulationFunction();
 
		performBasicSpaceTrimmingTests( function );
 
		final String expectedTrimPrep = "replace(replace(a.column,' ','${space}$'),'-',' ')";
		final String expectedPostTrimPrefix = "replace(replace(";
		final String expectedPostTrimSuffix = ",' ','-'),'${space}$',' ')";
 
		// -> trim(LEADING '-' FROM a.column) 
		String rendered = function.render( null, argList( "LEADING", "'-'", "FROM", trimSource ), null );
		String expected = expectedPostTrimPrefix + "ltrim(" + expectedTrimPrep + ")" + expectedPostTrimSuffix;
		assertEquals( expected, rendered );
 
		// -> trim(TRAILING '-' FROM a.column) 
		rendered = function.render( null, argList( "TRAILING", "'-'", "FROM", trimSource ), null );

5
CodeRank