Esempio n. 1
0
  private LayoutReport createSampleLayoutReport() {
    LayoutReport report = new LayoutReport();
    List<ValidationError> list = new LinkedList<ValidationError>();
    report.setValidationErrors(list);

    list.add(new ValidationError().withOnlyWarn(true));
    list.add(new ValidationError());
    list.add(new ValidationError());
    list.add(new ValidationError().withOnlyWarn(true));
    list.add(new ValidationError());

    List<LayoutSection> sections = new LinkedList<LayoutSection>();
    LayoutSection section = new LayoutSection();
    sections.add(section);
    report.setSections(sections);

    List<LayoutObject> objects = new LinkedList<LayoutObject>();
    section.setObjects(objects);
    LayoutObject object = new LayoutObject();
    objects.add(object);

    List<LayoutSpec> specs = new LinkedList<LayoutSpec>();
    object.setSpecs(specs);

    specs.add(passedSpec());
    specs.add(failedSpec());
    specs.add(failedSpec());
    specs.add(failedSpec());
    specs.add(warnSpec());
    specs.add(warnSpec());

    return report;
  }
Esempio n. 2
0
  @Test
  public void shouldReturn_errorsAndWarnings_properly() {
    LayoutReport report = createSampleLayoutReport();

    assertThat(report.errors(), is(3));
    assertThat(report.warnings(), is(2));
  }