@Test
  public void should_fail_if_tag_is_not_valid() {
    throwable.expect(IllegalArgumentException.class);
    throwable.expectMessage(
        "Tag 'th ag' is invalid. Rule tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'");

    Map<String, Object> properties = newHashMap();
    properties.put("tags", "th ag");

    DefaultIssue issue = mock(DefaultIssue.class);
    when(issue.tags()).thenReturn(ImmutableSet.of("tag1", "tag3"));

    Action.Context context = mock(Action.Context.class);
    when(context.issue()).thenReturn(issue);

    action.execute(properties, context);
  }
  @Test
  @SuppressWarnings("unchecked")
  public void should_execute() {
    Map<String, Object> properties = newHashMap();
    properties.put("tags", "tag2,tag3");

    DefaultIssue issue = mock(DefaultIssue.class);
    when(issue.tags()).thenReturn(ImmutableSet.of("tag1", "tag3"));

    Action.Context context = mock(Action.Context.class);
    when(context.issue()).thenReturn(issue);

    action.execute(properties, context);
    verify(issueUpdater)
        .setTags(
            eq(issue),
            (Collection<String>) Matchers.argThat(org.hamcrest.Matchers.containsInAnyOrder("tag1")),
            any(IssueChangeContext.class));
  }