aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2019-04-19 14:17:37 +0200
committerSonarTech <sonartech@sonarsource.com>2019-04-26 20:21:06 +0200
commitc58d901db830ca847311520104ad551bd680de26 (patch)
treeb8ca7d1ea33b63260d924c99380d0c8ded8204d8
parent1eb53b8a61cc122e36d90a1f23c5f9a062957408 (diff)
downloadsonarqube-c58d901db830ca847311520104ad551bd680de26.tar.gz
sonarqube-c58d901db830ca847311520104ad551bd680de26.zip
SONAR-10725 stabilize version of jsoup dependency
-rw-r--r--build.gradle3
-rw-r--r--sonar-testing-harness/build.gradle2
-rw-r--r--sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlListAssert.java21
-rw-r--r--sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlParagraphAssert.java19
4 files changed, 31 insertions, 14 deletions
diff --git a/build.gradle b/build.gradle
index 1a60bdeb266..a745db6189a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -211,6 +211,7 @@ subprojects {
dependency('org.codelibs.elasticsearch.module:analysis-common:6.6.1')
dependency 'org.freemarker:freemarker:2.3.20'
dependency 'org.hamcrest:hamcrest-all:1.3'
+ dependency 'org.jsoup:jsoup:1.11.3'
dependency 'org.mindrot:jbcrypt:0.4'
dependency('org.mockito:mockito-core:2.15.0') {
exclude 'org.hamcrest:hamcrest-core'
@@ -230,7 +231,7 @@ subprojects {
dependency 'org.sonarsource.orchestrator:sonar-orchestrator:3.24.0.1993'
dependency 'org.sonarsource.update-center:sonar-update-center-common:1.18.0.487'
dependency 'org.subethamail:subethasmtp:3.1.7'
- dependency 'xml-apis:xml-apis:1.4.01'
+ dependency 'xml-apis:xml-apis:1.4.01'
// please keep this list alphabetically ordered
}
diff --git a/sonar-testing-harness/build.gradle b/sonar-testing-harness/build.gradle
index c5001fbcfbd..eb2762a0e76 100644
--- a/sonar-testing-harness/build.gradle
+++ b/sonar-testing-harness/build.gradle
@@ -14,7 +14,7 @@ dependencies {
compile 'junit:junit'
compile 'org.assertj:assertj-core'
compile 'org.hamcrest:hamcrest-all'
- compile 'org.jsoup:jsoup:1.11.3'
+ compile 'org.jsoup:jsoup'
compileOnly 'com.google.code.findbugs:jsr305'
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlListAssert.java b/sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlListAssert.java
index 87de54c2465..8f75fd56c22 100644
--- a/sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlListAssert.java
+++ b/sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlListAssert.java
@@ -89,15 +89,25 @@ public class HtmlListAssert extends HtmlBlockAssert<HtmlListAssert> {
}
/**
- * Convenience method.
- * Sames as {@code hasParagraph().withText("")}.
+ * Verifies next paragraph is empty or contains only "&nbsp;"
*/
public HtmlParagraphAssert hasEmptyParagraph() {
- return hasParagraph()
- .withText("");
+ Element paragraph = hasParagraphImpl();
+
+ Assertions.assertThat(paragraph.text())
+ .describedAs(PRINT_FRAGMENT_TEMPLATE, paragraph)
+ .isIn("", "\u00A0");
+
+ return new HtmlParagraphAssert(paragraph, nextBlocks);
}
public HtmlParagraphAssert hasParagraph() {
+ Element element = hasParagraphImpl();
+
+ return new HtmlParagraphAssert(element, nextBlocks);
+ }
+
+ private Element hasParagraphImpl() {
isNotNull();
Assertions.assertThat(nextBlocks.hasNext())
@@ -106,8 +116,7 @@ public class HtmlListAssert extends HtmlBlockAssert<HtmlListAssert> {
Element element = nextBlocks.next();
HtmlParagraphAssert.verifyIsParagraph(element);
-
- return new HtmlParagraphAssert(element, nextBlocks);
+ return element;
}
/**
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlParagraphAssert.java b/sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlParagraphAssert.java
index bf7210afa33..2f073a7b7d3 100644
--- a/sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlParagraphAssert.java
+++ b/sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlParagraphAssert.java
@@ -52,6 +52,10 @@ public class HtmlParagraphAssert extends HtmlBlockAssert<HtmlParagraphAssert> {
* Verify the next block exists, is a paragraph and returns an Assert on this block.
*/
public HtmlParagraphAssert hasParagraph() {
+ return new HtmlParagraphAssert(hasParagraphImpl(), nextBlocks);
+ }
+
+ private Element hasParagraphImpl() {
isNotNull();
Assertions.assertThat(nextBlocks.hasNext())
@@ -60,8 +64,7 @@ public class HtmlParagraphAssert extends HtmlBlockAssert<HtmlParagraphAssert> {
Element element = nextBlocks.next();
verifyIsParagraph(element);
-
- return new HtmlParagraphAssert(element, nextBlocks);
+ return element;
}
/**
@@ -74,12 +77,16 @@ public class HtmlParagraphAssert extends HtmlBlockAssert<HtmlParagraphAssert> {
}
/**
- * Convenience method.
- * Sames as {@code hasParagraph().withText("")}.
+ * Verifies next paragraph is empty or contains only "&nbsp;"
*/
public HtmlParagraphAssert hasEmptyParagraph() {
- return hasParagraph()
- .withText("");
+ Element paragraph = hasParagraphImpl();
+
+ Assertions.assertThat(paragraph.text())
+ .describedAs(PRINT_FRAGMENT_TEMPLATE, paragraph)
+ .isIn("", "\u00A0");
+
+ return new HtmlParagraphAssert(paragraph, nextBlocks);
}
/**