Unit testing Spark transformation on DataFrame
Indeed, asJava looks awkward and completely unnecessary here. You can approach this problem in a few different ways. 


pass RDD[Row] instead of Seq[Row] to avoid asJava:

sqlContext.createDataFrame(sc.parallelize(Seq(Row(1), Row(2), Row(3))), schema

use product types instead of Row to avoid both asJava and passing schema:

sqlContext.createDataFrame(Seq(1, 2,  3).map(Tuple1(_))).toDF("a")


or

case class Record(x: Int)

sqlContext.createDataFrame(Seq(1, 2,  3).map(Record(_)))

use implicit conversions to avoid asJava and passing schema and get concise syntax (supported for Seq[Int] only in Spark 2.0+):

import spark.implicits._

Seq(1, 2, 3).toDF("a")



In general you should prefer product types (tuples, case classes) over Row objects. You get schema for free as well as some static typing.