I have the following code:
class ServletSpec extends Specification {
def createServlet[T <: HttpServlet](clazz: Class[T]): T = {
val instance = clazz.newInstance()
instance.init()
instance
}
}
That is called like this:
spec.createServlet( classOf[DocumentationServlet] )
How can I define this method so that I can call it like this:
spec.createServlet[DocumentationServlet]