use of org.sonarqube.ws.Favorites.Favorite in project sonarqube by SonarSource.
the class FavoritesWsTest method favorites_web_service.
@Test
public void favorites_web_service() {
// GET (nothing)
List<Favorite> favorites = adminClient.favorites().search(new SearchRequest()).getFavoritesList();
assertThat(favorites).isEmpty();
// POST (create favorites)
adminClient.favorites().add("sample");
adminClient.favorites().add("sample:src/main/xoo/sample/Sample.xoo");
// GET (created favorites)
favorites = adminClient.favorites().search(new SearchRequest()).getFavoritesList();
assertThat(favorites.stream().map(Favorite::getKey)).containsOnly("sample", "sample:src/main/xoo/sample/Sample.xoo");
// DELETE (a favorite)
adminClient.favorites().remove("sample");
favorites = adminClient.favorites().search(new SearchRequest()).getFavoritesList();
assertThat(favorites.stream().map(Favorite::getKey)).containsOnly("sample:src/main/xoo/sample/Sample.xoo");
}
Aggregations