added test written  in Java