Ejemplo n.º 1
0
  @Test(expected = SonarException.class)
  public void shouldFailIfAddingSameMeasures() {
    Bucket fileBucket = new Bucket(javaFile);
    Measure measure = new Measure(ncloc).setValue(1200.0);
    fileBucket.addMeasure(measure);

    measure = new Measure(ncloc).setValue(500.0);
    fileBucket.addMeasure(measure);
  }
Ejemplo n.º 2
0
  @Test
  public void shouldUpdateMeasure() {
    Bucket fileBucket = new Bucket(javaFile);
    Measure measure = new Measure(ncloc).setValue(1200.0);
    fileBucket.addMeasure(measure);

    assertThat(fileBucket.getMeasures(MeasuresFilters.all()).size(), is(1));
    assertThat(fileBucket.getMeasures(MeasuresFilters.metric(ncloc)).getValue(), is(1200.0));

    measure.setValue(500.0);
    fileBucket.addMeasure(measure);

    assertThat(fileBucket.getMeasures(MeasuresFilters.all()).size(), is(1));
    assertThat(fileBucket.getMeasures(MeasuresFilters.metric(ncloc)).getValue(), is(500.0));
  }