Added a better unit test example and updated the code, source: Yi Cao at Cranfield University