Bug 447747 - Junit test fails in org.eclipse.birt.tests.data.engine

Refactor Trailing function, and fix Junit test cases.

Signed-off-by: xinzhao-acutate <xzhao@actuate.com>