Background: I am using Play 2.4 (Java) with InjectedRoutesGenerator and a Guice module to configure various dependencies. But during unit tests, the FakeApplica
If you want to just load no routes at all, here's a trait you could mix in to your test class if you're using Scala, Guice and ScalaTest. This is working with Play 2.5. I've also shown how you could disable filters, since those are related to routing.
I know this is a little different from the ask on Java and Play 2.4, but this might be helpful to people as I got to this question trying to achieve something very similar.
trait DisabledRouting extends PlaySpec with OneAppPerSuite {
override def fakeApplication(): Application = {
configureApplication(new GuiceApplicationBuilder()
.router(Router.empty)
.configure("play.http.filters" -> "play.api.http.NoHttpFilters"))
.build()
}
/** Override to add additional configuration on top of disabled routing */
def configureApplication(appBuilder: GuiceApplicationBuilder): GuiceApplicationBuilder = appBuilder
}