Browse Source

Delete unused methods in org.sonar.test.html classes

tags/7.8
Simon Brandhof 5 years ago
parent
commit
d25ecbed89

+ 0
- 9
sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlFragmentAssert.java View File

.withText(text); .withText(text);
} }


/**
* Convenience method.
* Sames as {@code hasParagraph().withLines(line1, line2, ...)}.
*/
public HtmlParagraphAssert hasParagraph(String firstLine, String... otherLines) {
return hasParagraph()
.withLines(firstLine, otherLines);
}

} }

+ 0
- 31
sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlListAssert.java View File

return this; return this;
} }


public HtmlListAssert hasList() {
isNotNull();

Assertions.assertThat(nextBlocks.hasNext())
.describedAs("no more block")
.isTrue();

Element element = nextBlocks.next();
verifyIsList(element);

return new HtmlListAssert(element, nextBlocks);
}

/** /**
* Convenience method. * Convenience method.
* Sames as {@code hasParagraph().withText(text)}. * Sames as {@code hasParagraph().withText(text)}.
HtmlParagraphAssert.verifyIsParagraph(element); HtmlParagraphAssert.verifyIsParagraph(element);
return element; return element;
} }

/**
* Verifies there is no more list in the block.
*/
public void noMoreBlock() {
isNotNull();

Assertions.assertThat(nextBlocks.hasNext())
.describedAs("there are still some block. Next one:" + PRINT_FRAGMENT_TEMPLATE,
new Object() {
@Override
public String toString() {
return nextBlocks.next().toString();
}
})
.isFalse();
}

} }

+ 0
- 26
sonar-testing-harness/src/main/java/org/sonar/test/html/HtmlParagraphAssert.java View File

import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.assertj.core.api.Assertions; import org.assertj.core.api.Assertions;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
return new HtmlParagraphAssert(paragraph, nextBlocks); return new HtmlParagraphAssert(paragraph, nextBlocks);
} }


/**
* Convenience method.
* Sames as {@code hasParagraph().withLines(line1, line2, ...)}.
*/
public HtmlParagraphAssert hasParagraph(String firstLine, String... otherLines) {
return hasParagraph()
.withLines(firstLine, otherLines);
}

/** /**
* Verifies there is no more block. * Verifies there is no more block.
*/ */
return this; return this;
} }


/**
* Verifies the current block has all and only the specified lines, in any order.
*/
public HtmlParagraphAssert withLines(Set<String> lines) {
isNotNull();

List<String> actualLines = toLines(actual);
String[] expectedLines = lines.toArray(new String[0]);

Assertions.assertThat(actualLines)
.describedAs(PRINT_FRAGMENT_TEMPLATE, actual)
.containsOnly(expectedLines);

return this;
}

private static List<String> toLines(Element parent) { private static List<String> toLines(Element parent) {
Iterator<Node> iterator = parent.childNodes().iterator(); Iterator<Node> iterator = parent.childNodes().iterator();
if (!iterator.hasNext()) { if (!iterator.hasNext()) {

+ 0
- 12
sonar-testing-harness/src/main/java/org/sonar/test/html/MimeMessageAssert.java View File

return this; return this;
} }


public MimeMessageAssert hasSubject(String text) {
isNotNull();

try {
Assertions.assertThat(actual.getSubject()).isEqualTo(text);
} catch (MessagingException e) {
throw new IllegalStateException(e);
}

return this;
}

public MimeMessageAssert subjectContains(String text) { public MimeMessageAssert subjectContains(String text) {
isNotNull(); isNotNull();



Loading…
Cancel
Save