QualityProfileDto profile1 = QProfileTesting.newXooP1();
QualityProfileDto profile2 = QProfileTesting.newXooP2().setParentKee(QProfileTesting.XOO_P1_KEY);
when(profileLoader.findAll()).thenReturn(ImmutableList.of(profile1, profile2));
Language xoo = mock(Language.class);
when(xoo.getKey()).thenReturn("xoo");
when(xoo.getName()).thenReturn("Xoo");
Language whitespace = mock(Language.class);
when(whitespace.getKey()).thenReturn("ws");
when(whitespace.getName()).thenReturn("Whitespace");
when(languages.get("xoo")).thenReturn(xoo);
when(languages.all()).thenReturn(new Language[]{xoo, whitespace});
RuleRepositories.Repository repo1 = mock(RuleRepositories.Repository.class);
when(repo1.key()).thenReturn("xoo");