@Test
  public void covered_files() throws Exception {
    userSessionRule.addComponentUuidPermission(UserRole.CODEVIEWER, "SonarQube", "test-file-uuid");

    when(testIndex.searchByTestUuid(anyString()).fileUuid()).thenReturn("test-file-uuid");
    when(testIndex.coveredFiles("test-uuid"))
        .thenReturn(
            Arrays.asList(
                new CoveredFileDoc()
                    .setFileUuid("bar-uuid")
                    .setCoveredLines(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)),
                new CoveredFileDoc()
                    .setFileUuid("file-uuid")
                    .setCoveredLines(Arrays.asList(1, 2, 3))));
    when(dbClient.componentDao().selectByUuids(any(DbSession.class), anyList()))
        .thenReturn(
            Arrays.asList(
                newFileDto(newProjectDto(), "bar-uuid")
                    .setKey("org.foo.Bar.java")
                    .setLongName("src/main/java/org/foo/Bar.java"),
                newFileDto(newProjectDto(), "file-uuid")
                    .setKey("org.foo.File.java")
                    .setLongName("src/main/java/org/foo/File.java")));

    WsTester.TestRequest request =
        ws.newGetRequest("api/tests", "covered_files").setParam(TEST_UUID, "test-uuid");

    request.execute().assertJson(getClass(), "tests-covered-files.json");
  }