UKG interview question

Write a method with its Junit test case.