• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Checks类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GSet类代码示例发布时间:2022-05-22
下一篇:
Java WorkbenchViewerComparator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap