title: Scala singleton as instance of another class
body: <p>I have a singleton object, that handles database stuff for my application, but I would like to have a similiar class to be used during testing, so that I can have many smaller test databases that dont interfere with each other. <p>I could just drop the singleton and just create a new instance of the database class at startup, but that would mean I'd have to pass around this instance to everywhere where database actions are needed and I dont want that.</p>
  <p>I could make a singleton that would work as an interface to a single instance of the database class. Someting like this:</p>
  
  <pre><code>object DB{
      val db = new Database()
      def set(a:Int,b:Int) = db.set(a,b)
      def get(a:Int) = db.get(a)
  }
  </code></pre>
  
  <p>This just feels sort of stupid and pointless, especially when the database class is fairly big and I'd have to do that to all of the methods. Is there a better way to solve this problem?</p>
  
  <p>Thanks!</p>