HHH-8775 HHH-8769 unit tests

I have added a Junit test for JIRA bug issue HHH-8775 and HHH-8769