Skip to content

Commit 0c07fab

Browse files
committed
Incorporating comments for SPARK-2168
1 parent 6d7866d commit 0c07fab

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

core/src/test/scala/org/apache/spark/deploy/history/HistoryServerSuite.scala

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,43 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.spark.deploy.history
1819

20+
import javax.servlet.http.HttpServletRequest
21+
22+
import scala.collection.mutable
23+
24+
import org.apache.hadoop.fs.Path
25+
import org.mockito.Mockito.{when}
1926
import org.scalatest.FunSuite
2027
import org.scalatest.Matchers
2128
import org.scalatest.mock.MockitoSugar
22-
import javax.servlet.http.HttpServletRequest
23-
import org.mockito.Mockito.{when}
24-
import org.apache.hadoop.fs.Path
29+
2530
import org.apache.spark.ui.SparkUI
26-
import scala.collection.mutable
2731

2832
class HistoryServerSuite extends FunSuite with Matchers with MockitoSugar {
29-
30-
val historyServer = mock[HistoryServer]
31-
val request = mock[HttpServletRequest]
32-
33-
test("generate history page with relative links") {
33+
34+
test("generate history page with relative links") {
35+
val historyServer = mock[HistoryServer]
36+
val request = mock[HttpServletRequest]
3437
val ui = mock[SparkUI]
3538
val link = "/history/app1"
36-
val info = new ApplicationHistoryInfo("app1", "app1", 0, 2, 1, "xxx", true )
39+
val info = new ApplicationHistoryInfo("app1", "app1", 0, 2, 1, "xxx", true)
3740
when(historyServer.getApplicationList()).thenReturn(Seq(info))
3841
when(ui.basePath).thenReturn(link)
3942
when(historyServer.getProviderConfig()).thenReturn(Map[String, String]())
4043
val page = new HistoryPage(historyServer)
41-
44+
4245
//when
4346
val response = page.render(request)
44-
47+
4548
//then
46-
val links = response \\ "a"
47-
val justHrefs = for {
48-
l <- links
49-
attrs <- l.attribute("href")
50-
} yield (attrs.toString)
51-
justHrefs should contain(link)
49+
val links = response \\ "a"
50+
val justHrefs = for {
51+
l <- links
52+
attrs <- l.attribute("href")
53+
} yield (attrs.toString)
54+
justHrefs should contain(link)
5255
}
5356
}

0 commit comments

Comments
 (0)