]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7135 WS api/measures/component_tree sorting does not depend on metric direction
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Thu, 14 Jan 2016 14:22:42 +0000 (15:22 +0100)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Thu, 14 Jan 2016 17:53:45 +0000 (18:53 +0100)
server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java
server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java

index 2cd5f81b1f9b040eaecf18fa4a0761adb7328075..f2ccb842042b0d9779825e58cfd52a2e7eecd087 100644 (file)
@@ -130,7 +130,7 @@ class ComponentTreeSort {
         return null;
       }
 
-      return metric.getDirection() >= 0 ? measure.getValue() : -measure.getValue();
+      return measure.getValue();
     }
   }
 
index 1efa56e50c8ade1ab81c23dfff13416099addfa1..5341852e50b9040b92d9a44a1490a047d71fc683 100644 (file)
@@ -111,17 +111,6 @@ public class ComponentTreeSortTest {
       .containsExactly("path-1", "path-2", "path-3", "path-4", "path-5", "path-6", "path-7", "path-8", "path-9");
   }
 
-  @Test
-  public void sort_by_metric_key_with_negative_metric_direction() {
-    metrics.get(0).setDirection(-1);
-    ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), true, METRIC_KEY);
-
-    List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest);
-
-    assertThat(result).extracting("path")
-      .containsExactly("path-9", "path-8", "path-7", "path-6", "path-5", "path-4", "path-3", "path-2", "path-1");
-  }
-
   @Test
   public void sort_on_multiple_fields() {
     components = newArrayList(