diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-06-19 14:25:32 +0200 |
---|---|---|
committer | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2015-06-19 15:42:25 +0200 |
commit | dd03761c7936d7f1111ded5c4fc630620ec6cc88 (patch) | |
tree | 760a08f51bbf819827fde40cb1300d761f6b8344 | |
parent | 8efd88fe45abf50406b2d94638ba1161e88db5f1 (diff) | |
download | sonarqube-dd03761c7936d7f1111ded5c4fc630620ec6cc88.tar.gz sonarqube-dd03761c7936d7f1111ded5c4fc630620ec6cc88.zip |
add support for Optional<Measure> to MeasureAssert
-rw-r--r-- | server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureAssert.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureAssert.java b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureAssert.java index c42c9faeb2a..ab75827e1b9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureAssert.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/measure/MeasureAssert.java @@ -19,18 +19,23 @@ */ package org.sonar.server.computation.measure; +import com.google.common.base.Optional; import java.util.Objects; +import javax.annotation.Nullable; import org.assertj.core.api.AbstractAssert; public class MeasureAssert extends AbstractAssert<MeasureAssert, Measure> { - protected MeasureAssert(Measure actual) { + protected MeasureAssert(@Nullable Measure actual) { super(actual, MeasureAssert.class); } public static MeasureAssert assertThat(Measure actual) { return new MeasureAssert(actual); } + public static MeasureAssert assertThat(@Nullable Optional<Measure> actual) { + return new MeasureAssert(actual == null ? null : actual.orNull()); + } public MeasureAssert hasValueType(Measure.ValueType expected) { isNotNull(); |