Stub method that returns the content immediately.
Stub method that returns the content immediately. Useful for unit testing.
val stubParser = bodyParser(AnyContent("hello"))
the content to return, AnyContentAsEmpty by default
a BodyParser for type T that returns Accumulator.done(Right(content))
Create a minimal controller components, useful for unit testing.
Create a minimal controller components, useful for unit testing.
In most cases, you'll want the standard defaults:
val controller = new MyController(stubControllerComponents())
A custom body parser can be used with bodyParser() to provide a request body to the controller:
val cc = stubControllerComponents(bodyParser(AnyContent("request body text")))
the body parser used to parse any content, stubBodyParser(AnyContentAsEmpty) by default.
the playbodyparsers, defaults to stubPlayBodyParsers(NoMaterializer)
the langs instance for messaging, new DefaultLangs() by default.
the mime type associated with file extensions, new DefaultFileMimeTypes(FileMimeTypesConfiguration() by default.
an execution context, defaults to ExecutionContext.global
a fully configured ControllerComponents instance.
default as Seq(Lang.defaultLang).
a stub Langs
Stub method that returns a play.api.i18n.Messages instance.
Stub method that returns a play.api.i18n.Messages instance.
the messagesApi to use, uses stubMessagesApi by default.
the request to use, FakeRequest by default.
the Messages instance
Returns a stub DefaultMessagesApi with default values and an empty map.
Returns a stub DefaultMessagesApi with default values and an empty map.
map of languages to map of messages, empty by default.
stubLangs() by default
"PLAY_LANG" by default
false by default
false by default
configuration, HttpConfiguration() by default.
the messagesApi with minimal configuration.
Stub method that returns a play.api.mvc.MessagesRequest instance.
Stub method that returns a play.api.mvc.MessagesRequest instance.
the messagesApi to use, uses stubMessagesApi by default.
the request to use, FakeRequest by default.
the Messages instance
Stub method for unit testing, using NoTemporaryFileCreator.
Stub method for unit testing, using NoTemporaryFileCreator.
the input materializer.
a minimal PlayBodyParsers for unit testing.