CAMEL-8116: add unit tests
CAMEL-8116: fix truncation logic