Added test cases and Junit test