https://github.com/ulfsauer0815/assertj-jsoup
AssertJ assertions for HTML
https://github.com/ulfsauer0815/assertj-jsoup
assertj assertj-assertions java jsoup kotlin kotlin-dsl testing
Last synced: 2 months ago
JSON representation
AssertJ assertions for HTML
- Host: GitHub
- URL: https://github.com/ulfsauer0815/assertj-jsoup
- Owner: ulfsauer0815
- License: mit
- Created: 2020-11-13T17:21:48.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-10-20T20:04:44.000Z (5 months ago)
- Last Synced: 2025-10-20T22:10:00.896Z (5 months ago)
- Topics: assertj, assertj-assertions, java, jsoup, kotlin, kotlin-dsl, testing
- Language: Kotlin
- Homepage:
- Size: 338 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AssertJ assertions for HTML

[](https://mvnrepository.com/artifact/io.github.ulfs/assertj-jsoup)
[](https://jitpack.io/#ulfsauer0815/assertj-jsoup)
[](https://coveralls.io/github/ulfsauer0815/assertj-jsoup)
[](https://codecov.io/gh/ulfsauer0815/assertj-jsoup)
Provides assertions for HTML content including a Kotlin DSL.
Uses [jsoup](https://jsoup.org/) for parsing.
## Example
### Kotlin DSL
```kotlin
assertThatSpec(document) {
node("h1") { exists() }
node(".example-code") { containsText("Kotlin") }
node(".github-link") {
hasText("Fork me on GitHub")
attribute("href") {
containsText("github")
containsText("assertj-jsoup")
}
attribute("target") { hasText("_blank") }
attribute("disabled") { notExists() }
}
}
```
### Java / Kotlin
```kotlin
assertThat(document)
.elementExists("h1")
.elementContainsText(".example-code", "Kotlin")
.elementHasText(".github-link", "Fork me on GitHub")
.elementAttributeContainsText(".github-link", "href", "github")
.elementAttributeContainsText(".github-link", "href", "assertj-jsoup")
.elementAttributeHasText(".github-link", "target", "_blank")
.elementAttributeNotExists(".github-link", "disabled");
```
## Build configuration
### Kotlin
*`build.gradle.kts`*
```kotlin
repositories {
mavenCentral()
}
testImplementation("io.github.ulfs:assertj-jsoup:0.1.4")
```
### Gradle
*`build.gradle`*
```groovy
repositories {
mavenCentral()
}
testImplementation "io.github.ulfs:assertj-jsoup:0.1.4"
```
## Development
see [DEVELOPMENT.md](DEVELOPMENT.md)