fix checkstyle error and add tests