FELIX-4314 Fixed the code as described. Adapted the test cases as this affected some of the mock objects we were constructing.