trait MyService {
  def metricProvider: OtherService1

  // My work goes below
  def getMetrics: Seq[Metric] {
    // code that actually uses dep1 and dep2 to get metrics
  }
}

object MyService extends MyService {
  override val metricProvider = new CloudWatchService
}

class MyServiceTests extends org.scalatest.FlatSpec with org.scalatest.matchers.ShouldMatchers {
  
  "MyService" should "return no metrics if it ghets none from its metric provider" in {
    // Set up
    val underTest = new MyService {
      override val metricProvider = mock[CloudWatchService]
    }

    underTest.metricProvider.getCloudwatchMetrics returns List.empty[Metric]

    // Run test and check expectations
    underTest.getMetrics should be (Seq.empty[Metric])
  }
}

class Person {
  public String getName()
}

object Person {
  public Array<Person> getPeople();
}

Person.getName() // doesn't compile
new Person().getPeople // doesn't compile


class MyServiceImpl @Inject(val dep1: OtherService1, val dep2: OtherService2) extends MyService