2 * Sonar, open source software quality management tool.
\r
3 * Copyright (C) 2009 SonarSource SA
\r
4 * mailto:contact AT sonarsource DOT com
\r
6 * Sonar is free software; you can redistribute it and/or
\r
7 * modify it under the terms of the GNU Lesser General Public
\r
8 * License as published by the Free Software Foundation; either
\r
9 * version 3 of the License, or (at your option) any later version.
\r
11 * Sonar is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
14 * Lesser General Public License for more details.
\r
16 * You should have received a copy of the GNU Lesser General Public
\r
17 * License along with Sonar; if not, write to the Free Software
\r
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
\r
21 package org.sonar.plugins.squid.bridges;
\r
23 import org.junit.Test;
\r
24 import static org.mockito.Mockito.verify;
\r
25 import static org.mockito.Mockito.never;
\r
26 import static org.mockito.Matchers.*;
\r
27 import org.sonar.api.resources.JavaFile;
\r
28 import org.sonar.api.resources.JavaPackage;
\r
29 import org.sonar.api.measures.CoreMetrics;
\r
30 import org.sonar.api.measures.Measure;
\r
31 import org.sonar.api.test.IsMeasure;
\r
33 public class ClassComplexityDistributionBridgeTest extends BridgeTestCase {
\r
36 public void classComplexityDistribution() {
\r
37 verify(context).saveMeasure(eq(new JavaPackage("org.apache.struts.config")), argThat(new IsMeasure(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION, "0=10;5=3;10=2;20=1;30=4;60=4;90=1")));
\r
38 verify(context, never()).saveMeasure(eq(new JavaFile("org.apache.struts.config.ConfigRuleSet")), eq(new Measure(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION, "equals() on measure only uses the metric")));
\r
39 verify(context, never()).saveMeasure(eq(project), eq(new Measure(CoreMetrics.CLASS_COMPLEXITY_DISTRIBUTION, "equals() on measure only uses the metric")));
\r