title: How to mock methods of Spark SqlContext?
body: <p>I am writing one Spark application using Scala and I am trying to write unit tests for a method which will load data from Hive table, do some processing on it and return the result as a data frame.</p>
  
  <p>Method looks as shown below:</p>
  
  <pre><code>private def filterData(SqlContext context, tableName): DataFrame = {
    val table = context.table(tableName)
    val selectColumnList = Seq("colA", "colB")
    table.select(selectColumnList).filter(table.col("colC") &gt; 100)
  }
  </code></pre>
  
  <p>I would like to know how can I mock <code>SqlContext.table()</code> method so that I can supply some test data whenever it is called or is there any other way to achieve it using Scala?</p>