LPS-46191 Add the logic that was present in the listeners through the usage of JUnit rules (we will be following this approach)