appBar: new AppBar(
leading: Icon(Icons.person,),
title: new Text("الرئيسية",
style: new TextStyle(fontFamily: 'RPT Bold',
fontSize: 16.0,
color: Colors.amber
),
),
centerTitle: true,
iconTheme: new IconThemeData(color: Colors.amber),
),
有两个抽象定义
BuiltInComponentsFromContext
abstract def
httpFilters: Seq[EssentialFilter]
abstract def
router: Router
特征可以与NoHttpFiltersComponents
一起使用,并且如果使用,则不需要在BuiltInComponentsFromContext
中提供abstract def
httpFilters: Seq[EssentialFilter]
的实现。我是否可以使用类似的特征,而无需提供BuiltInComponentsFromContext
的实现?
在单元测试中,我扩展了router
OneAppPerSuiteWithComponents
但是我真的不需要class UserControllerUnitSpec extends PlaySpec with BeforeAndAfterAll with BeforeAndAfterEach with OneAppPerSuiteWithComponents{
override def components: BuiltInComponents = new BuiltInComponentsFromContext(context) with NoHttpFiltersComponents {
import play.api.mvc.Results
import play.api.routing.Router
import play.api.routing.sird._
lazy val router: Router = Router.from({
case GET(p"/") => defaultActionBuilder {
Results.Ok("success!")
}
})
override lazy val configuration: Configuration = context.initialConfiguration ++ Configuration(
"play.mailer.host" -> "localhost",
"mail.signupUrl" -> "/ws/users/signup/")
}
}
。我需要参考router
,因为我想测试一些application
。因此,提供configuration
实现似乎是不必要的。我想知道是否可以扩展router
而不提供OneAppPerSuiteWithComponents