Example usage for org.apache.commons.collections ListUtils EMPTY_LIST

List of usage examples for org.apache.commons.collections ListUtils EMPTY_LIST

Introduction

In this page you can find the example usage for org.apache.commons.collections ListUtils EMPTY_LIST.

Prototype

List EMPTY_LIST

To view the source code for org.apache.commons.collections ListUtils EMPTY_LIST.

Click Source Link

Document

An empty unmodifiable list.

Usage

From source file:org.sonar.pickbasic.tree.impl.statement.LoopStatementTreeImpl.java

public LoopStatementTreeImpl(InternalSyntaxToken loopKeyword, WhileUntilClauseTree whileUntilClause,
        FromClausePickTree fromClause, DoRepeatClauseTree doRepeatClause) {
    this.loopKeyword = loopKeyword;
    this.statements = ListUtils.EMPTY_LIST;
    this.whileUntilClause = whileUntilClause;
    this.fromClause = fromClause;
    this.doRepeatClause = doRepeatClause;
}

From source file:org.sonar.pickbasic.tree.impl.statement.PerformStatementTreeImpl.java

public PerformStatementTreeImpl(InternalSyntaxToken performKeyword, ExpressionTree expression,
        @Nullable SyntaxToken semicolonToken) {
    this.performKeyword = performKeyword;
    this.expression = expression;
    this.settingClause = ListUtils.EMPTY_LIST;
    this.semicolonToken = semicolonToken;
}

From source file:org.sonar.pickbasic.tree.impl.statement.ThenClauseMultiLineTreeImpl.java

public ThenClauseMultiLineTreeImpl(InternalSyntaxToken thenKeyword, InternalSyntaxToken endKeyword) {
    this.thenKeyword = thenKeyword;
    this.statements = ListUtils.EMPTY_LIST;
    ;//  w  ww  . j av a  2  s  . c o m
    this.endKeyword = endKeyword;
}

From source file:org.sonar.plugins.erlang.ErlangSquidSensorTest.java

@Test
public void should_execute_on_erlang_project() {
    Project project = new Project("key");
    ModuleFileSystem fs = mock(ModuleFileSystem.class);
    ErlangSquidSensor erlangSensor = new ErlangSquidSensor(mock(RulesProfile.class), fs, null);

    when(fs.files(Mockito.any(FileQuery.class))).thenReturn(ListUtils.EMPTY_LIST);
    assertThat(erlangSensor.shouldExecuteOnProject(project)).isFalse();

    when(fs.files(Mockito.any(FileQuery.class))).thenReturn(ImmutableList.of(new File("/tmp")));
    assertThat(erlangSensor.shouldExecuteOnProject(project)).isTrue();
}

From source file:org.sonar.plugins.python.pylint.PylintSensorTest.java

@Test
public void shouldExecuteOnlyWhenNecessary() {
    // which means: only on python projects and only if
    // there is at least one active pylint rule

    Project pythonProject = createProjectForLanguage(Python.KEY);
    Project foreignProject = createProjectForLanguage("whatever");
    RulesProfile emptyProfile = mock(RulesProfile.class);
    RulesProfile pylintProfile = createPylintProfile();

    when(fs.files(any(FileQuery.class))).thenReturn(ImmutableList.of(new File("/tmp")));
    checkNecessityOfExecution(pythonProject, pylintProfile, true);
    checkNecessityOfExecution(pythonProject, emptyProfile, false);

    when(fs.files(any(FileQuery.class))).thenReturn(ListUtils.EMPTY_LIST);
    checkNecessityOfExecution(foreignProject, pylintProfile, false);
    checkNecessityOfExecution(foreignProject, emptyProfile, false);
}

From source file:org.sonar.plugins.python.PythonSquidSensorTest.java

@Test
public void should_execute_on_python_project() {
    Project project = mock(Project.class);
    ModuleFileSystem fs = mock(ModuleFileSystem.class);
    PythonSquidSensor sensor = new PythonSquidSensor(mock(RulesProfile.class), fileLinesContextFactory, fs,
            mock(ResourcePerspectives.class));

    when(fs.files(any(FileQuery.class))).thenReturn(ListUtils.EMPTY_LIST);
    assertThat(sensor.shouldExecuteOnProject(project)).isFalse();

    when(fs.files(any(FileQuery.class))).thenReturn(ImmutableList.of(new File("/tmp")));
    assertThat(sensor.shouldExecuteOnProject(project)).isTrue();
}

From source file:org.sonar.plugins.scmstats.HgScmAdapterPowerMockTest.java

@Test
public void shouldCreateActivityMapWithoutAffectedFiles() throws HgRepositoryNotFoundException {
    when(hgRepo.initFrom(projectBaseDir)).thenReturn(Boolean.FALSE);
    HgScmAdapter hgScmAdapter = new HgScmAdapter(hgRepo, config, fileExclusions, moduleFileSystem);
    HgChangeset hgChangeSet = mock(HgChangeset.class);

    when(hgChangeSet.getAddedFiles()).thenReturn(ListUtils.EMPTY_LIST);
    when(hgChangeSet.getModifiedFiles()).thenReturn(ListUtils.EMPTY_LIST);
    when(hgChangeSet.getRemovedFiles()).thenReturn(ListUtils.EMPTY_LIST);

    Map<String, Integer> activities = hgScmAdapter.createActivityMap(hgChangeSet);
    assertThat(activities).isEmpty();/*  www  . j  a  va  2s . c o  m*/

}

From source file:org.sonar.plugins.xml.XmlSensorTest.java

@Test
public void should_execute_on_javascript_project() {
    Project project = new Project("key");
    ModuleFileSystem fs = mock(ModuleFileSystem.class);
    XmlSensor sensor = new XmlSensor(mock(RulesProfile.class), fs, mock(ResourcePerspectives.class));

    when(fs.files(any(FileQuery.class))).thenReturn(ListUtils.EMPTY_LIST);
    assertThat(sensor.shouldExecuteOnProject(project)).isFalse();

    when(fs.files(Mockito.any(FileQuery.class))).thenReturn(ImmutableList.of(new File("/tmp")));
    assertThat(sensor.shouldExecuteOnProject(project)).isTrue();
}

From source file:org.squashtest.tm.service.internal.bugtracker.BugTrackerManagerServiceImpl.java

@Override
public List<BugTracker> findDistinctBugTrackersForProjects(List<Long> projectIds) {
    if (projectIds.isEmpty()) {
        return ListUtils.EMPTY_LIST;
    }/*from w  ww  .j  a va2  s  .  c o m*/
    return bugTrackerDao.findDistinctBugTrackersForProjects(projectIds);
}

From source file:org.xwiki.component.wiki.DefaultWikiComponentBuilderTest.java

@Test
public void buildComponents() throws Exception {
    getMockery().checking(new Expectations() {
        {//from   w w  w .ja  va 2 s.c  o  m
            oneOf(bridge).hasProgrammingRights(DOC_REFERENCE);
            will(returnValue(true));
            oneOf(bridge).getAuthorReference(DOC_REFERENCE);
            will(returnValue(AUTHOR_REFERENCE));
            oneOf(bridge).getRoleType(DOC_REFERENCE);
            will(returnValue(TestRole.class));
            oneOf(bridge).getRoleHint(DOC_REFERENCE);
            will(returnValue("test"));
            oneOf(bridge).getScope(DOC_REFERENCE);
            will(returnValue(WikiComponentScope.WIKI));
            oneOf(bridge).getHandledMethods(DOC_REFERENCE);
            will(returnValue(MapUtils.EMPTY_MAP));
            oneOf(bridge).getDependencies(DOC_REFERENCE);
            will(returnValue(MapUtils.EMPTY_MAP));
            oneOf(bridge).getDeclaredInterfaces(DOC_REFERENCE);
            will(returnValue(ListUtils.EMPTY_LIST));
            oneOf(bridge).getSyntax(DOC_REFERENCE);
            will(returnValue(Syntax.XWIKI_2_1));
        }
    });

    List<WikiComponent> components = this.builder.buildComponents(DOC_REFERENCE);

    Assert.assertEquals(1, components.size());
}