@Test
public void compute_coupling_metrics() throws IOException {

  SensorContextTester context = SensorContextTester.create(new File(""));
  fileSystem = context.fileSystem();
  // package 'org' contains class 'Greeting', used by no other class, but using classes 'Bar' and 'Foo'
  DefaultInputDir org = addFileWithParentFolder("src/test/resources/org/sonar/plugins/groovy/gmetricswithcoupling/org", "Greeting.groovy");
  // package 'org.foo' contains class 'Foo', used by class 'Greeting', and using class 'Bar'
  DefaultInputDir org_foo = addFileWithParentFolder("src/test/resources/org/sonar/plugins/groovy/gmetricswithcoupling/org/foo", "Foo.groovy");
  // package 'org.bar' contains class 'Bar', used by classes 'Greeting' and 'Foo', but using no other class
  DefaultInputDir org_bar = addFileWithParentFolder("src/test/resources/org/sonar/plugins/groovy/gmetricswithcoupling/org/bar", "Bar.groovy");
  FileLinesContext fileLinesContext = mock(FileLinesContext.class);
  when(fileLinesContextFactory.createFor(any(DefaultInputFile.class))).thenReturn(fileLinesContext);
  sensor = new GroovySensor(settings, fileLinesContextFactory, fileSystem);
  sensor.execute(context);
  assertCouplingMeasureAre(context, org.key(), 3, 1.0, 3, 1.0);
  assertCouplingMeasureAre(context, org_foo.key(), 1, 1.0, 1, 1.0);
  assertCouplingMeasureAre(context, org_bar.key(), 2, 2.0, 0, 0.0);
}