当前位置: 首页>>代码示例>>Java>>正文


Java Checks类代码示例

本文整理汇总了Java中org.sonar.api.batch.rule.Checks的典型用法代码示例。如果您正苦于以下问题:Java Checks类的具体用法?Java Checks怎么用?Java Checks使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Checks类属于org.sonar.api.batch.rule包,在下文中一共展示了Checks类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createIssueSensorBackedByMocks

import org.sonar.api.batch.rule.Checks; //导入依赖的package包/类
@Before
  public void createIssueSensorBackedByMocks() {
    ResourcePerspectives resourcePerspectives = mock(ResourcePerspectives.class);
    Checks<Object> checks = mock(Checks.class);
    CheckFactory checkFactory = mock(CheckFactory.class);
    when(checkFactory.create(Mockito.anyString())).thenReturn(checks);
    List<Object> checksList = Arrays.asList(new Object[] {realIfOneStringExistsBothMustExistMultiFileCheck});
    when(checks.all()).thenReturn(checksList);

    when(checks.ruleKey(Mockito.isA(StringDisallowedIfMatchInAnotherFileCheck.class))).thenReturn(RuleKey.of("text", "StringDisallowedIfMatchInAnotherFileCheck"));
    when(checks.ruleKey(Mockito.isA(MultiFileIfOneStringExistsThenBothMustExistCheck.class))).thenReturn(RuleKey.of("text", "MultiFileIfOneStringExistsThenBothMustExistCheck"));
//    realStringDisallowedMultiFileCheck.setRuleKey(RuleKey.parse("text:StringDisallowedIfMatchInAnotherFileCheck")); // Not strictly necessary here. Normally set by the framework to the value in the Check class's annotation

    when(checks.addAnnotatedChecks(Mockito.anyCollection())).thenReturn(checks);
    mockIssuable = mock(Issuable.class);
    when(resourcePerspectives.as(Mockito.eq(Issuable.class), Mockito.isA(InputFile.class))).thenReturn(mockIssuable);
    IssueBuilder mockIssueBuilder = mock(IssueBuilder.class);
    when(mockIssuable.newIssueBuilder()).thenReturn(mockIssueBuilder);
    when(mockIssueBuilder.ruleKey(Mockito.isA(RuleKey.class))).thenReturn(mockIssueBuilder);
    when(mockIssueBuilder.line(Mockito.anyInt())).thenReturn(mockIssueBuilder);
    when(mockIssueBuilder.message(Mockito.anyString())).thenReturn(mockIssueBuilder);
    when(mockIssueBuilder.build()).thenReturn(mock(Issue.class));

    sensor = new TextIssueSensor(fs, resourcePerspectives, checkFactory, project);
  }
 
开发者ID:gjd6640,项目名称:sonar-text-plugin,代码行数:26,代码来源:MultiFileIfOneExistsThenBothMustExistCheckTest.java

示例2: createIssueSensorBackedByMocks

import org.sonar.api.batch.rule.Checks; //导入依赖的package包/类
@Before
  public void createIssueSensorBackedByMocks() {
    ResourcePerspectives resourcePerspectives = mock(ResourcePerspectives.class);
    Checks<Object> checks = mock(Checks.class);
    CheckFactory checkFactory = mock(CheckFactory.class);
    when(checkFactory.create(Mockito.anyString())).thenReturn(checks);
    List<Object> checksList = Arrays.asList(new Object[] {realStringDisallowedMultiFileCheck});
    when(checks.all()).thenReturn(checksList);

    when(checks.ruleKey(Mockito.isA(StringDisallowedIfMatchInAnotherFileCheck.class))).thenReturn(RuleKey.of("text", "StringDisallowedIfMatchInAnotherFileCheck"));
//    realStringDisallowedMultiFileCheck.setRuleKey(RuleKey.parse("text:StringDisallowedIfMatchInAnotherFileCheck")); // Not strictly necessary here. Normally set by the framework to the value in the Check class's annotation

    when(checks.addAnnotatedChecks(Mockito.anyCollection())).thenReturn(checks);
    mockIssuable = mock(Issuable.class);
    when(resourcePerspectives.as(Mockito.eq(Issuable.class), Mockito.isA(InputFile.class))).thenReturn(mockIssuable);
    IssueBuilder mockIssueBuilder = mock(IssueBuilder.class);
    when(mockIssuable.newIssueBuilder()).thenReturn(mockIssueBuilder);
    when(mockIssueBuilder.ruleKey(Mockito.isA(RuleKey.class))).thenReturn(mockIssueBuilder);
    when(mockIssueBuilder.line(Mockito.anyInt())).thenReturn(mockIssueBuilder);
    when(mockIssueBuilder.message(Mockito.anyString())).thenReturn(mockIssueBuilder);
    when(mockIssueBuilder.build()).thenReturn(mock(Issue.class));

    sensor = new TextIssueSensor(fs, resourcePerspectives, checkFactory, project);
  }
 
开发者ID:gjd6640,项目名称:sonar-text-plugin,代码行数:25,代码来源:StringDisallowedIfMatchInAnotherFileCheckTest.java

示例3: createIssueSensorBackedByMocks

import org.sonar.api.batch.rule.Checks; //导入依赖的package包/类
@Before
public void createIssueSensorBackedByMocks() {
ResourcePerspectives resourcePerspectives = mock(ResourcePerspectives.class);
Checks<Object> checks = mock(Checks.class);
CheckFactory checkFactory = mock(CheckFactory.class);
when(checkFactory.create(Mockito.anyString())).thenReturn(checks);
textCheckMock = mock(AbstractTextCheck.class);
List<Object> checksList = Arrays.asList(new Object[] {textCheckMock});
when(checks.all()).thenReturn(checksList);

when(checks.addAnnotatedChecks(Mockito.anyCollection())).thenReturn(checks);
mockIssuable = mock(Issuable.class);
when(resourcePerspectives.as(Mockito.eq(Issuable.class), Mockito.isA(InputFile.class))).thenReturn(mockIssuable);
IssueBuilder mockIssueBuilder = mock(IssueBuilder.class);
when(mockIssuable.newIssueBuilder()).thenReturn(mockIssueBuilder);
when(mockIssueBuilder.ruleKey(Mockito.isA(RuleKey.class))).thenReturn(mockIssueBuilder);
when(mockIssueBuilder.line(Mockito.anyInt())).thenReturn(mockIssueBuilder);
when(mockIssueBuilder.message(Mockito.anyString())).thenReturn(mockIssueBuilder);
when(mockIssueBuilder.build()).thenReturn(mock(Issue.class));

sensor = new TextIssueSensor(fs, resourcePerspectives, checkFactory, project);
}
 
开发者ID:gjd6640,项目名称:sonar-text-plugin,代码行数:23,代码来源:IssueSensorTest.java

示例4: all

import org.sonar.api.batch.rule.Checks; //导入依赖的package包/类
public List<GherkinCheck> all() {
  List<GherkinCheck> allVisitors = Lists.newArrayList();

  for (Checks<GherkinCheck> checks : checksByRepository) {
    allVisitors.addAll(checks.all());
  }

  return allVisitors;
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:10,代码来源:GherkinChecks.java

示例5: ruleKeyFor

import org.sonar.api.batch.rule.Checks; //导入依赖的package包/类
@Nullable
public RuleKey ruleKeyFor(GherkinCheck check) {
  RuleKey ruleKey;

  for (Checks<GherkinCheck> checks : checksByRepository) {
    ruleKey = checks.ruleKey(check);

    if (ruleKey != null) {
      return ruleKey;
    }
  }
  return null;
}
 
开发者ID:racodond,项目名称:sonar-gherkin-plugin,代码行数:14,代码来源:GherkinChecks.java

示例6: all

import org.sonar.api.batch.rule.Checks; //导入依赖的package包/类
public List<JavaPropertiesCheck> all() {
  List<JavaPropertiesCheck> allVisitors = Lists.newArrayList();

  for (Checks<JavaPropertiesCheck> checks : checksByRepository) {
    allVisitors.addAll(checks.all());
  }

  return allVisitors;
}
 
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:10,代码来源:JavaPropertiesChecks.java

示例7: ruleKeyFor

import org.sonar.api.batch.rule.Checks; //导入依赖的package包/类
@Nullable
public RuleKey ruleKeyFor(JavaPropertiesCheck check) {
  RuleKey ruleKey;

  for (Checks<JavaPropertiesCheck> checks : checksByRepository) {
    ruleKey = checks.ruleKey(check);

    if (ruleKey != null) {
      return ruleKey;
    }
  }
  return null;
}
 
开发者ID:racodond,项目名称:sonar-jproperties-plugin,代码行数:14,代码来源:JavaPropertiesChecks.java

示例8: all

import org.sonar.api.batch.rule.Checks; //导入依赖的package包/类
public List<JSONCheck> all() {
  List<JSONCheck> allVisitors = Lists.newArrayList();

  for (Checks<JSONCheck> checks : checksByRepository) {
    allVisitors.addAll(checks.all());
  }

  return allVisitors;
}
 
开发者ID:racodond,项目名称:sonar-json-plugin,代码行数:10,代码来源:JSONChecks.java

示例9: ruleKeyFor

import org.sonar.api.batch.rule.Checks; //导入依赖的package包/类
@Nullable
public RuleKey ruleKeyFor(JSONCheck check) {
  RuleKey ruleKey;

  for (Checks<JSONCheck> checks : checksByRepository) {
    ruleKey = checks.ruleKey(check);

    if (ruleKey != null) {
      return ruleKey;
    }
  }
  return null;
}
 
开发者ID:racodond,项目名称:sonar-json-plugin,代码行数:14,代码来源:JSONChecks.java


注:本文中的org.sonar.api.batch.rule.Checks类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。