JenkinsPipelineUnit - testing custom classes that use steps

Imagine I have a custom class under src directory. This class’s constructor takes the this from a script so that it can call steps such as sh or echo internally. What is the right approach to unit test this class? How do I inject a mock this and control the behaviour of the steps?