Migrate tests to ScalaTest, close #1389