aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task-projectanalysis
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2019-01-11 09:57:52 +0100
committersonartech <sonartech@sonarsource.com>2019-01-16 09:42:58 +0100
commit6a653cd1091bb549fc5043b3066b7bfb45da2883 (patch)
treed8a6ebcce237b4ff7b7d2da57306b9739e0de6f8 /server/sonar-ce-task-projectanalysis
parent8b78d75ecf3b0d8d40147355388d2853c698f3ce (diff)
downloadsonarqube-6a653cd1091bb549fc5043b3066b7bfb45da2883.tar.gz
sonarqube-6a653cd1091bb549fc5043b3066b7bfb45da2883.zip
Fix Quality flaw
Diffstat (limited to 'server/sonar-ce-task-projectanalysis')
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java2
-rw-r--r--server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java11
2 files changed, 3 insertions, 10 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java
index 672517a0315..d75d00ab445 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/measure/Measure.java
@@ -238,7 +238,7 @@ public final class Measure {
*/
public boolean getBooleanValue() {
checkValueType(ValueType.BOOLEAN);
- return value == 1.0D;
+ return value != null && value.intValue() == 1;
}
/**
diff --git a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java
index 378ba83bc96..4351d5e40c7 100644
--- a/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java
+++ b/server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/measure/MeasureTest.java
@@ -19,13 +19,11 @@
*/
package org.sonar.ce.task.projectanalysis.measure;
-import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.tngtech.java.junit.dataprovider.DataProvider;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
import com.tngtech.java.junit.dataprovider.UseDataProvider;
import java.util.List;
-import javax.annotation.Nonnull;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -42,7 +40,7 @@ import static org.sonar.ce.task.projectanalysis.measure.Measure.newMeasureBuilde
@RunWith(DataProviderRunner.class)
public class MeasureTest {
- private static final Measure INT_MEASURE = newMeasureBuilder().create((int) 1);
+ private static final Measure INT_MEASURE = newMeasureBuilder().create(1);
private static final Measure LONG_MEASURE = newMeasureBuilder().create(1l);
private static final Measure DOUBLE_MEASURE = newMeasureBuilder().create(1d, 1);
private static final Measure STRING_MEASURE = newMeasureBuilder().create("some_sT ring");
@@ -95,12 +93,7 @@ public class MeasureTest {
private static Object[][] getMeasuresExcept(final ValueType valueType) {
return from(MEASURES)
- .filter(new Predicate<Measure>() {
- @Override
- public boolean apply(@Nonnull Measure input) {
- return input.getValueType() != valueType;
- }
- }).transform(WrapInSingleElementArray.INSTANCE)
+ .filter(input -> input.getValueType() != valueType).transform(WrapInSingleElementArray.INSTANCE)
.toArray(Object[].class);
}