Exemplo n.º 1
0
  @Test
  public void testGetReporter() {
    try {
      SonarQuery.getReporter(query, "foo");
    } catch (IllegalStateException e) {
      // expected
    }

    query.setAttribute(SonarQuery.REPORTER, SonarQuery.ANY_USER);
    assertThat(SonarQuery.getReporter(query, "foo"), nullValue());

    query.setAttribute(SonarQuery.REPORTER, SonarQuery.UNASSIGNED);
    assertThat(SonarQuery.getReporter(query, "foo"), is(new String[] {""}));

    query.setAttribute(SonarQuery.REPORTER, SonarQuery.CURRENT_USER);
    assertThat(SonarQuery.getReporter(query, "foo"), is(new String[] {"foo"}));

    query.setAttribute(SonarQuery.REPORTER, SonarQuery.SPECIFIED_USER);
    query.setAttribute(SonarQuery.REPORTER_USER, "bar");
    assertThat(SonarQuery.getReporter(query, "foo"), is(new String[] {"bar"}));
  }