diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2012-06-12 00:19:13 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2012-06-12 00:19:13 +0200 |
commit | be495313fad66765c91a00902d681c05f897a49d (patch) | |
tree | b1e36c9345ae92881ea483ffb72d09cb1356d85b /plugins | |
parent | 998ffc63c98dd1d81d88a2d1304d7f8ec24c2a04 (diff) | |
download | sonarqube-be495313fad66765c91a00902d681c05f897a49d.tar.gz sonarqube-be495313fad66765c91a00902d681c05f897a49d.zip |
Remove dead code
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecoratorTest.java | 119 |
1 files changed, 3 insertions, 116 deletions
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecoratorTest.java index 102fd8b85b5..f1446b19d18 100644 --- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecoratorTest.java +++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ReviewsMeasuresDecoratorTest.java @@ -19,14 +19,12 @@ */ package org.sonar.plugins.core.sensors; -import com.google.common.collect.Lists; import com.google.common.collect.Maps; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.time.DateUtils; import org.hamcrest.BaseMatcher; import org.hamcrest.Description; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.sonar.api.batch.DecoratorContext; import org.sonar.api.measures.CoreMetrics; @@ -65,10 +63,6 @@ public class ReviewsMeasuresDecoratorTest { @Before public void setUp() { reviewDao = mock(ReviewDao.class); -// when(reviewDao.selectByQuery(argThat(openReviewQueryMatcher()))).thenReturn(createListOf10Reviews()); -// when(reviewDao.countByQuery(argThat(unassignedReviewQueryMatcher()))).thenReturn(2); -// when(reviewDao.countByQuery(argThat(plannedReviewQueryMatcher()))).thenReturn(3); -// when(reviewDao.countByQuery(argThat(falsePositiveReviewQueryMatcher()))).thenReturn(4); rightNow = new Date(); tenDaysAgo = DateUtils.addDays(rightNow, -10); @@ -120,42 +114,6 @@ public class ReviewsMeasuresDecoratorTest { } @Test - @Ignore - public void shouldComputeReviewsMetricsOnFile() throws Exception { - Resource<?> resource = new File("foo").setId(1); - decorator.decorate(resource, context); - - verify(context).saveMeasure(CoreMetrics.ACTIVE_REVIEWS, 10d); - verify(context).saveMeasure(CoreMetrics.UNASSIGNED_REVIEWS, 2d); - verify(context).saveMeasure(CoreMetrics.UNPLANNED_REVIEWS, 7d); - verify(context).saveMeasure(CoreMetrics.FALSE_POSITIVE_REVIEWS, 4d); - verify(context).saveMeasure(CoreMetrics.UNREVIEWED_VIOLATIONS, 35d - 10d); - } - - @Test - @Ignore - public void shouldComputeReviewsMetricsOnProject() throws Exception { - when(context.getChildrenMeasures(CoreMetrics.ACTIVE_REVIEWS)).thenReturn( - Lists.newArrayList(new Measure(CoreMetrics.ACTIVE_REVIEWS, 7d))); - when(context.getChildrenMeasures(CoreMetrics.UNASSIGNED_REVIEWS)).thenReturn( - Lists.newArrayList(new Measure(CoreMetrics.UNASSIGNED_REVIEWS, 1d))); - when(context.getChildrenMeasures(CoreMetrics.UNPLANNED_REVIEWS)).thenReturn( - Lists.newArrayList(new Measure(CoreMetrics.UNPLANNED_REVIEWS, 2d))); - when(context.getChildrenMeasures(CoreMetrics.FALSE_POSITIVE_REVIEWS)).thenReturn( - Lists.newArrayList(new Measure(CoreMetrics.FALSE_POSITIVE_REVIEWS, 2d))); - - Resource<?> resource = new Project("foo").setId(1); - decorator.decorate(resource, context); - - // As same values used for #shouldComputeReviewMetricsOnFile, we just add the children measures to verify - verify(context).saveMeasure(CoreMetrics.ACTIVE_REVIEWS, 10d + 7d); - verify(context).saveMeasure(CoreMetrics.UNASSIGNED_REVIEWS, 2d + 1d); - verify(context).saveMeasure(CoreMetrics.UNPLANNED_REVIEWS, 7d + 2d); - verify(context).saveMeasure(CoreMetrics.FALSE_POSITIVE_REVIEWS, 4d + 2d); - verify(context).saveMeasure(CoreMetrics.UNREVIEWED_VIOLATIONS, 35d - (10d + 7d)); - } - - @Test public void shouldTrackNewViolationsWithoutReview() throws Exception { Resource<?> resource = new File("foo").setId(1); Violation v1 = Violation.create((Rule) null, resource).setPermanentId(1); // test the null case for the created_at date @@ -174,77 +132,6 @@ public class ReviewsMeasuresDecoratorTest { verify(context).saveMeasure(argThat(new IsVariationMeasure(CoreMetrics.NEW_UNREVIEWED_VIOLATIONS, 1.0, 3.0))); } - // private List<ReviewDto> createListOf10Reviews() { - // List<ReviewDto> reviews = Lists.newArrayList(); - // for (int i = 1; i < 11; i++) { - // reviews.add(new ReviewDto().setViolationPermanentId(i)); - // } - // return reviews; - // } -// -// private BaseMatcher<ReviewQuery> openReviewQueryMatcher() { -// return new BaseMatcher<ReviewQuery>() { -// public boolean matches(Object o) { -// ReviewQuery query = (ReviewQuery) o; -// if (query == null) { -// return false; -// } -// return Lists.newArrayList(ReviewDto.STATUS_OPEN, ReviewDto.STATUS_REOPENED).equals(query.getStatuses()) -// && query.getNoAssignee() == null && query.getPlanned() == null; -// } -// -// public void describeTo(Description description) { -// } -// }; -// } -// -// private BaseMatcher<ReviewQuery> unassignedReviewQueryMatcher() { -// return new BaseMatcher<ReviewQuery>() { -// public boolean matches(Object o) { -// ReviewQuery query = (ReviewQuery) o; -// if (query == null) { -// return false; -// } -// return Lists.newArrayList(ReviewDto.STATUS_OPEN, ReviewDto.STATUS_REOPENED).equals(query.getStatuses()) -// && query.getNoAssignee() == Boolean.TRUE; -// } -// -// public void describeTo(Description description) { -// } -// }; -// } -// -// private BaseMatcher<ReviewQuery> plannedReviewQueryMatcher() { -// return new BaseMatcher<ReviewQuery>() { -// public boolean matches(Object o) { -// ReviewQuery query = (ReviewQuery) o; -// if (query == null) { -// return false; -// } -// return Lists.newArrayList(ReviewDto.STATUS_OPEN, ReviewDto.STATUS_REOPENED).equals(query.getStatuses()) -// && query.getPlanned() == Boolean.TRUE; -// } -// -// public void describeTo(Description description) { -// } -// }; -// } -// -// private BaseMatcher<ReviewQuery> falsePositiveReviewQueryMatcher() { -// return new BaseMatcher<ReviewQuery>() { -// public boolean matches(Object o) { -// ReviewQuery query = (ReviewQuery) o; -// if (query == null) { -// return false; -// } -// return Lists.newArrayList(ReviewDto.RESOLUTION_FALSE_POSITIVE).equals(query.getResolutions()); -// } -// -// public void describeTo(Description description) { -// } -// }; -// } - private class IsVariationMeasure extends BaseMatcher<Measure> { private Metric metric = null; private Double var1 = null; @@ -262,9 +149,9 @@ public class ReviewsMeasuresDecoratorTest { } Measure m = (Measure) o; return ObjectUtils.equals(metric, m.getMetric()) && - ObjectUtils.equals(var1, m.getVariation1()) && - ObjectUtils.equals(var2, m.getVariation2()) && - !(m instanceof RuleMeasure); + ObjectUtils.equals(var1, m.getVariation1()) && + ObjectUtils.equals(var2, m.getVariation2()) && + !(m instanceof RuleMeasure); } public void describeTo(Description o) { |