migrate to groovy, add a test