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


Java ReportHelper类代码示例

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


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

示例1: failedConcepts

import com.buschmais.jqassistant.core.report.api.ReportHelper; //导入依赖的package包/类
@Test
public void failedConcepts() {
    Result<Concept> infoConceptResult = mockResult("test:infoConcept", Concept.class, Result.Status.FAILURE, Severity.INFO);
    Result<Concept> minorConceptResult = mockResult("test:minorConcept", Concept.class, Result.Status.FAILURE, Severity.MINOR);
    Result<Concept> majorConceptResult = mockResult("test:majorConcept", Concept.class, Result.Status.FAILURE, Severity.MAJOR);
    Map<String, Result<Concept>> conceptResults = new HashMap<>();
    conceptResults.put("test:infoConcept", infoConceptResult);
    conceptResults.put("test:minorConcept", minorConceptResult);
    conceptResults.put("test:majorConcept", majorConceptResult);
    when(inMemoryReportWriter.getConceptResults()).thenReturn(conceptResults);
    int violations = reportHelper.verifyConceptResults(Severity.MINOR, Severity.MAJOR, inMemoryReportWriter);
    assertThat(violations, equalTo(1));
    verifyMessages(debugMessages, ReportHelper.CONCEPT_FAILED_HEADER, "Concept: test:infoConcept", "Severity: INFO");
    verifyMessages(warnMessages, ReportHelper.CONCEPT_FAILED_HEADER, "Concept: test:minorConcept", "Severity: MINOR");
    verifyMessages(errorMessages, ReportHelper.CONCEPT_FAILED_HEADER, "Concept: test:majorConcept", "Severity: MAJOR");
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:17,代码来源:ReportHelperTest.java

示例2: failedConceptsWithOverriddenSeverity

import com.buschmais.jqassistant.core.report.api.ReportHelper; //导入依赖的package包/类
@Test
public void failedConceptsWithOverriddenSeverity() {
    Result<Concept> infoConceptResult = mockResult("test:infoConcept", Concept.class, Result.Status.FAILURE, Severity.INFO, Severity.MINOR);
    Result<Concept> minorConceptResult = mockResult("test:minorConcept", Concept.class, Result.Status.FAILURE, Severity.MINOR, Severity.MAJOR);
    Result<Concept> majorConceptResult = mockResult("test:majorConcept", Concept.class, Result.Status.FAILURE, Severity.MAJOR, Severity.CRITICAL);
    Map<String, Result<Concept>> conceptResults = new HashMap<>();
    conceptResults.put("test:infoConcept", infoConceptResult);
    conceptResults.put("test:minorConcept", minorConceptResult);
    conceptResults.put("test:majorConcept", majorConceptResult);
    when(inMemoryReportWriter.getConceptResults()).thenReturn(conceptResults);
    int violations = reportHelper.verifyConceptResults(Severity.MAJOR, Severity.CRITICAL, inMemoryReportWriter);
    assertThat(violations, equalTo(1));
    verifyMessages(debugMessages, ReportHelper.CONCEPT_FAILED_HEADER, "Concept: test:infoConcept", "Severity: MINOR (from INFO)");
    verifyMessages(warnMessages, ReportHelper.CONCEPT_FAILED_HEADER, "Concept: test:minorConcept", "Severity: MAJOR (from MINOR)");
    verifyMessages(errorMessages, ReportHelper.CONCEPT_FAILED_HEADER, "Concept: test:majorConcept", "Severity: CRITICAL (from MAJOR)");
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:17,代码来源:ReportHelperTest.java

示例3: verifyAnalysisResults

import com.buschmais.jqassistant.core.report.api.ReportHelper; //导入依赖的package包/类
private void verifyAnalysisResults(InMemoryReportWriter inMemoryReportWriter, ReportHelper reportHelper,
                                   Severity effectiveFailOnSeverity)
    throws MojoFailureException {
    int conceptViolations = reportHelper.verifyConceptResults(warnOnSeverity, effectiveFailOnSeverity, inMemoryReportWriter);
    int constraintViolations = reportHelper.verifyConstraintResults(warnOnSeverity, effectiveFailOnSeverity, inMemoryReportWriter);

    boolean hasConceptViolations = conceptViolations > 0;
    boolean hasConstraintViolations = constraintViolations > 0;
    boolean hasViolations = hasConceptViolations || hasConstraintViolations;

    if (hasViolations) {
        throw new MojoFailureException("Violations detected: " + conceptViolations + " concepts, " + constraintViolations + " constraints");
    }
}
 
开发者ID:buschmais,项目名称:jqa-maven-plugin,代码行数:15,代码来源:AnalyzeMojo.java

示例4: initialize

import com.buschmais.jqassistant.core.report.api.ReportHelper; //导入依赖的package包/类
@Override
public void initialize(PluginRepository pluginRepository, Map<String, Object> pluginProperties) throws CliExecutionException {
    this.pluginRepository = pluginRepository;
    this.pluginProperties = pluginProperties;
    this.ruleHelper = new RuleHelper(LOGGER);
    this.reportHelper = new ReportHelper(LOGGER);
}
 
开发者ID:buschmais,项目名称:jqa-commandline-tool,代码行数:8,代码来源:AbstractTask.java

示例5: before

import com.buschmais.jqassistant.core.report.api.ReportHelper; //导入依赖的package包/类
@Before
public void before() {
    reportHelper = new ReportHelper(logger);
    debugMessages = new ArrayList<>();
    warnMessages = new ArrayList<>();
    errorMessages = new ArrayList<>();
    doAnswer(new LogAnswer(debugMessages)).when(logger).debug(Mockito.anyString());
    doAnswer(new LogAnswer(warnMessages)).when(logger).warn(Mockito.anyString());
    doAnswer(new LogAnswer(errorMessages)).when(logger).error(Mockito.anyString());
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:11,代码来源:ReportHelperTest.java

示例6: failedConstraints

import com.buschmais.jqassistant.core.report.api.ReportHelper; //导入依赖的package包/类
@Test
public void failedConstraints() {
    Map<String, Object> infoRow = new HashMap<>();
    infoRow.put("InfoElement", "InfoValue");
    Result<Constraint> infoConstraintResult = mockResult("test:infoConstraint", Constraint.class, Result.Status.FAILURE, Severity.INFO,
            Collections.singletonList(infoRow));
    Map<String, Object> minorRow = new HashMap<>();
    minorRow.put("MinorElement", "MinorValue");
    Result<Constraint> minorConstraintResult = mockResult("test:minorConstraint", Constraint.class, Result.Status.FAILURE, Severity.MINOR,
            Collections.singletonList(minorRow));
    Map<String, Object> majorRow = new HashMap<>();
    majorRow.put("MajorElement", "MajorValue");
    Result<Constraint> majorConstraintResult = mockResult("test:majorConstraint", Constraint.class, Result.Status.FAILURE, Severity.MAJOR,
            Collections.singletonList(majorRow));
    Map<String, Result<Constraint>> constraintResults = new HashMap<>();
    constraintResults.put("test:infoConstraint", infoConstraintResult);
    constraintResults.put("test:minorConstraint", minorConstraintResult);
    constraintResults.put("test:majorConstraint", majorConstraintResult);
    when(inMemoryReportWriter.getConstraintResults()).thenReturn(constraintResults);
    int violations = reportHelper.verifyConstraintResults(Severity.MINOR, Severity.MAJOR, inMemoryReportWriter);
    assertThat(violations, equalTo(1));
    verifyMessages(debugMessages, ReportHelper.CONSTRAINT_VIOLATION_HEADER, "Constraint: test:infoConstraint", "Severity: INFO", "InfoElement=InfoValue");
    verifyMessages(warnMessages, ReportHelper.CONSTRAINT_VIOLATION_HEADER, "Constraint: test:minorConstraint", "Severity: MINOR",
            "MinorElement=MinorValue");
    verifyMessages(errorMessages, ReportHelper.CONSTRAINT_VIOLATION_HEADER, "Constraint: test:majorConstraint", "Severity: MAJOR",
            "MajorElement=MajorValue");
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:28,代码来源:ReportHelperTest.java

示例7: failedConstraintsWithOverriddenSeverity

import com.buschmais.jqassistant.core.report.api.ReportHelper; //导入依赖的package包/类
@Test
public void failedConstraintsWithOverriddenSeverity() {
    Map<String, Object> infoRow = new HashMap<>();
    infoRow.put("InfoElement", "InfoValue");
    Result<Constraint> infoConstraintResult = mockResult("test:infoConstraint", Constraint.class, Result.Status.FAILURE, Severity.INFO, Severity.MINOR,
            Collections.singletonList(infoRow));
    Map<String, Object> minorRow = new HashMap<>();
    minorRow.put("MinorElement", "MinorValue");
    Result<Constraint> minorConstraintResult = mockResult("test:minorConstraint", Constraint.class, Result.Status.FAILURE, Severity.MINOR, Severity.MAJOR,
            Collections.singletonList(minorRow));
    Map<String, Object> majorRow = new HashMap<>();
    majorRow.put("MajorElement", "MajorValue");
    Result<Constraint> majorConstraintResult = mockResult("test:majorConstraint", Constraint.class, Result.Status.FAILURE, Severity.MAJOR,
            Severity.CRITICAL, Collections.singletonList(majorRow));
    Map<String, Result<Constraint>> constraintResults = new HashMap<>();
    constraintResults.put("test:infoConstraint", infoConstraintResult);
    constraintResults.put("test:minorConstraint", minorConstraintResult);
    constraintResults.put("test:majorConstraint", majorConstraintResult);
    when(inMemoryReportWriter.getConstraintResults()).thenReturn(constraintResults);
    int violations = reportHelper.verifyConstraintResults(Severity.MAJOR, Severity.CRITICAL, inMemoryReportWriter);
    assertThat(violations, equalTo(1));
    verifyMessages(debugMessages, ReportHelper.CONSTRAINT_VIOLATION_HEADER, "Constraint: test:infoConstraint", "Severity: MINOR (from INFO)",
            "InfoElement=InfoValue");
    verifyMessages(warnMessages, ReportHelper.CONSTRAINT_VIOLATION_HEADER, "Constraint: test:minorConstraint", "Severity: MAJOR (from MINOR)",
            "MinorElement=MinorValue");
    verifyMessages(errorMessages, ReportHelper.CONSTRAINT_VIOLATION_HEADER, "Constraint: test:majorConstraint", "Severity: CRITICAL (from MAJOR)",
            "MajorElement=MajorValue");
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:29,代码来源:ReportHelperTest.java

示例8: label

import com.buschmais.jqassistant.core.report.api.ReportHelper; //导入依赖的package包/类
@Test
public void label() {
    TestDescriptorWithLanguageElement descriptorWithLabel = mock(TestDescriptorWithLanguageElement.class);
    when(descriptorWithLabel.getValue()).thenReturn("value");
    assertThat(ReportHelper.getLabel(descriptorWithLabel), equalTo("value"));
    assertThat(ReportHelper.getLabel(Collections.singletonList(descriptorWithLabel)), equalTo("[value]"));
    assertThat(ReportHelper.getLabel(new String[] { "value1", "value2" }), equalTo("[value1,value2]"));
    Map<String, Object> map = new HashMap<>();
    map.put("key1", descriptorWithLabel);
    map.put("key2", "simpleValue");
    assertThat(ReportHelper.getLabel(map), equalTo("{key1:value,key2:simpleValue}"));
    TestDescriptorWithLanguageElement descriptorWithEmptyLanguageLabel = mock(TestDescriptorWithLanguageElement.class);
    assertThat(ReportHelper.getLabel(descriptorWithEmptyLanguageLabel), notNullValue());
}
 
开发者ID:buschmais,项目名称:jqa-core-framework,代码行数:15,代码来源:ReportHelperTest.java


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