@Test(expected = NotFoundException.class)
 public void add_tags_key_not_found() throws Exception {
   tester
       .newRequest("add_tags")
       .setParam("key", "polop:palap")
       .setParam("tags", "tag1,tag2")
       .execute();
 }
  @Test
  public void add_tags() throws Exception {
    String ruleKey = "squid:AvoidCycle";
    Rule rule = createStandardRule();
    when(rules.findByKey(RuleKey.of("squid", "AvoidCycle"))).thenReturn(rule);

    MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN);
    WsTester.TestRequest request =
        tester.newRequest("add_tags").setParam("key", ruleKey).setParam("tags", "tag1,tag2");
    request.execute().assertNoContent();

    ArgumentCaptor<Object> newTagsCaptor = ArgumentCaptor.forClass(Object.class);
    verify(rules).updateRuleTags(isA(Integer.class), newTagsCaptor.capture());
    Object newTags = newTagsCaptor.getValue();
    assertThat(newTags).isInstanceOf(List.class);
    assertThat((List<String>) newTags).hasSize(4).containsOnly("admin1", "admin2", "tag1", "tag2");
  }