diff options
author | Sébastien Lesaint <sebastien.lesaint@sonarsource.com> | 2019-04-19 14:17:37 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-04-26 20:21:06 +0200 |
commit | c58d901db830ca847311520104ad551bd680de26 (patch) | |
tree | b8ca7d1ea33b63260d924c99380d0c8ded8204d8 /sonar-testing-harness | |
parent | 1eb53b8a61cc122e36d90a1f23c5f9a062957408 (diff) | |
download | sonarqube-c58d901db830ca847311520104ad551bd680de26.tar.gz sonarqube-c58d901db830ca847311520104ad551bd680de26.zip |
SONAR-10725 stabilize version of jsoup dependency
Diffstat (limited to 'sonar-testing-harness')
3 files changed, 29 insertions, 13 deletions
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 " " */ 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 " " */ 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); } /** |