aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-07-22 14:17:06 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-07-22 14:17:16 +0200
commitc98aca6054048d0293fdb713910b4fa98beaa524 (patch)
tree2335acba0b9ecab3115dc6a49e67db4431dcd53b /sonar-batch/src
parent5539cfffd327697a49278361901335e2d4d6e075 (diff)
downloadsonarqube-c98aca6054048d0293fdb713910b4fa98beaa524.tar.gz
sonarqube-c98aca6054048d0293fdb713910b4fa98beaa524.zip
Improve utility org.sonar.core.util.Protobuf
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/report/MeasuresPublisherTest.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/report/MeasuresPublisherTest.java b/sonar-batch/src/test/java/org/sonar/batch/report/MeasuresPublisherTest.java
index 5ee11f7cdf9..a14389648e6 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/report/MeasuresPublisherTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/report/MeasuresPublisherTest.java
@@ -22,6 +22,7 @@ package org.sonar.batch.report;
import java.io.File;
import java.util.Collections;
import java.util.Date;
+import org.apache.commons.lang.exception.ExceptionUtils;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -42,6 +43,7 @@ import org.sonar.core.util.CloseableIterator;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -106,16 +108,18 @@ public class MeasuresPublisherTest {
@Test
public void fail_with_IAE_when_measure_has_no_value() throws Exception {
- thrown.expect(IllegalArgumentException.class);
- thrown.expectMessage("Measure on metric 'coverage' and component 'foo:src/Foo.php' has no value, but it's not allowed");
-
Measure measure = new Measure<>(CoreMetrics.COVERAGE);
when(measureCache.byResource(sampleFile)).thenReturn(Collections.singletonList(measure));
File outputDir = temp.newFolder();
BatchReportWriter writer = new BatchReportWriter(outputDir);
- publisher.publish(writer);
+ try {
+ publisher.publish(writer);
+ fail();
+ } catch (RuntimeException e) {
+ assertThat(ExceptionUtils.getFullStackTrace(e)).contains("Measure on metric 'coverage' and component 'foo:src/Foo.php' has no value, but it's not allowed");
+ }
}
}