[](https://bintray.com/robstoll/tutteli-jars/atrium/_latestVersion "Download from Bintray")
[](https://kotlinlang.slack.com/messages/C887ZKGCQ "See invitation link under section FAQ")
@@ -7,14 +7,13 @@
[](https://github.com/robstoll/atrium/actions/)
[](https://github.com/robstoll/atrium/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22 "Ask in slack for help")
-->
<!-- for a specific release -->
<!--
[](https://bintray.com/robstoll/tutteli-jars/atrium/0.9.2 "Download 0.9.2 from Bintray")
[](https://bintray.com/robstoll/tutteli-jars/atrium/0.10.0 "Download 0.10.0 from Bintray")
[](https://kotlinlang.slack.com/messages/C887ZKGCQ "See invitation link under section FAQ")
[](https://github.com/robstoll/atrium/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22 "Ask in slack for help")
It also includes an automated way of establishing the dependency to Atrium.
Atrium itself is using mocha as well
(see [build.gradle -> createJsTestTask](https://github.com/robstoll/atrium/tree/master/build.gradle#L290))
(see [build.gradle -> createJsTestTask](https://github.com/robstoll/atrium/tree/v0.10.0/build.gradle#L290))
and has tests written in JS modules
(see [AdjustStackTest](https://github.com/robstoll/atrium/tree/master/core/robstoll-lib/atrium-core-robstoll-lib-js/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackTest.kt))
as well as tests written in common modules (e.g. [SmokeTest](https://github.com/robstoll/atrium/tree/master/bundles/fluent-en_GB/atrium-fluent-en_GB-common/src/test/kotlin/SmokeTest.kt))
(see [AdjustStackTest](https://github.com/robstoll/atrium/tree/v0.10.0/core/robstoll-lib/atrium-core-robstoll-lib-js/src/test/kotlin/ch/tutteli/atrium/core/robstoll/lib/reporting/AdjustStackTest.kt))
as well as tests written in common modules (e.g. [SmokeTest](https://github.com/robstoll/atrium/tree/v0.10.0/bundles/fluent-en_GB/atrium-fluent-en_GB-common/src/test/kotlin/SmokeTest.kt))
which are executed on the JS platform as well
(actually on all platforms -> JVM uses JUnit for this purpose, see
expected that subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) (readme.examples.ReadmeSpec$1$Person <1234789>)
◆▶nickname(false): "Mr. Robert" <1234789>
@@ -637,7 +636,7 @@ in case you miss a shortcut.
<summary>💬 Write own feature assertion functions with additional checks.</summary>
Atrium provides a feature extractor which allows to make feature assertions in a safe way in case they are only valid for certain input.
See `ExpectImpl.feature.extractor`. It is for instance used for [`List.get`](https://github.com/robstoll/atrium/tree/master/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/listAssertions.kt)
See `ExpectImpl.feature.extractor`. It is for instance used for [`List.get`](https://github.com/robstoll/atrium/tree/v0.10.0/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/listAssertions.kt)
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
◆contains, in any order:
@@ -943,7 +942,7 @@ This is reflected in the output, which tells us that we expected that the `numbe
Exactly, what about the expected value `2`, why do we not see anything about it in the output?
The output does not show anything about the expected value `2` because the predefined assertion verbs have configured [`ReporterBuilder`](#reporterbuilder)
to use an [Only Failure Reporter](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.core/-core-factory/new-only-failure-reporter.html)
to use an [Only Failure Reporter](https://docs.atriumlib.org/0.10.0/doc/ch.tutteli.atrium.core/-core-factory/new-only-failure-reporter.html)
which shows us only assertions (or sub assertions) which failed.
# How is Atrium different from other Assertion Libraries
@@ -1555,7 +1554,7 @@ We try to provide a workaround whenever possible._
There is, but IntelliJ will not show it to you due to [this bug](https://youtrack.jetbrains.com/issue/KT-24836) (please upvote it).
You should be able to see the KDoc of other functions without problems.
But in case, you can also browse the online documentation, e.g. [KDoc of toBe](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.cc.en_-g-b/to-be.html).
But in case, you can also browse the online documentation, e.g. [KDoc of toBe](https://docs.atriumlib.org/0.10.0/doc/ch.tutteli.atrium.api.cc.en_-g-b/to-be.html).
</details>
@@ -1628,7 +1627,7 @@ expect {
}
}.toThrow<IllegalStateException> { messageContains("no no no") }
@@ -2045,7 +2044,7 @@ fun <T : List<Pair<String, String>>> Expect<T>.sameInitialsAs(
</code-own-compose-7>
There are a few additional methods which you can call after `mapArguments`.
See [KDoc of ArgumentMapperBuilder](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.domain.builders.utils/-argument-mapper-builder/index.html).
See [KDoc of ArgumentMapperBuilder](https://docs.atriumlib.org/0.10.0/doc/ch.tutteli.atrium.domain.builders.utils/-argument-mapper-builder/index.html).
In case you want to provide your own implementation it suffices to create an
extension function for `ArgumentMapperBuilder`.
@@ -2055,21 +2054,21 @@ extension function for `ArgumentMapperBuilder`.
Yet, sometimes we would like to create functions which have a better error reporting than the one we get
Its a builder and thus lets you find the functions you need via code completion.
Following a quick overview what it provides:
- all assertion functions on the domain level (what you have seen in [Compose-assertion-functions](#compose-assertion-functions)
was the API level) so that you can reuse and compose them in other ways.
- `ExpectImpl.builder` to create different kinds of assertions (see [AssertionBuilder](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.assertions.builders/-assertion-builder/index.html) for more information).
- `ExpectImpl.builder` to create different kinds of assertions (see [AssertionBuilder](https://docs.atriumlib.org/0.10.0/doc/ch.tutteli.atrium.assertions.builders/-assertion-builder/index.html) for more information).
- `ExpectImpl.changeSubject` which allows to change the subject either:
- `unreported`; meaning it does not show up in reporting (e.g. `Expect<Array<out T>>.asIterable()` uses it, see [arrayAssertions](https://github.com/robstoll/atrium/tree/master/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/cc/en_GB/arrayAssertions.kt#L17))
- reported, using `reportBuilder`; meaning a subject transformation which is shown in reporting as it incorporates a transformation (e.g. `isA` uses it, see [anyAssertions](https://github.com/robstoll/atrium/tree/master/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/anyAssertions.kt#L62))
- `ExpectImpl.collector` which allows to collect assertions - especially helpful in creating explanatory assertions (see [mapAssertions](https://github.com/robstoll/atrium/tree/master/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/mapAssertions.kt#L41))
- `ExpectImpl.feature.extractor` for feature assertions which are not always save to extract (see [`List.get`](https://github.com/robstoll/atrium/tree/master/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/listAssertions.kt))
- `unreported`; meaning it does not show up in reporting (e.g. `Expect<Array<out T>>.asIterable()` uses it, see [arrayAssertions](https://github.com/robstoll/atrium/tree/v0.10.0/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/cc/en_GB/arrayAssertions.kt#L17))
- reported, using `reportBuilder`; meaning a subject transformation which is shown in reporting as it incorporates a transformation (e.g. `isA` uses it, see [anyAssertions](https://github.com/robstoll/atrium/tree/v0.10.0/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/anyAssertions.kt#L62))
- `ExpectImpl.collector` which allows to collect assertions - especially helpful in creating explanatory assertions (see [mapAssertions](https://github.com/robstoll/atrium/tree/v0.10.0/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/mapAssertions.kt#L41))
- `ExpectImpl.feature.extractor` for feature assertions which are not always save to extract (see [`List.get`](https://github.com/robstoll/atrium/tree/v0.10.0/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/listAssertions.kt))
You can find an example in [floatingPointAssertions](https://github.com/robstoll/atrium/tree/master/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/floatingPointAssertions.kt#L33)
You can find an example in [floatingPointAssertions](https://github.com/robstoll/atrium/tree/v0.10.0/domain/robstoll-lib/atrium-domain-robstoll-lib-common/src/main/kotlin/ch/tutteli/atrium/domain/robstoll/lib/creating/floatingPointAssertions.kt#L33)
which makes use of explanatory assertions as well as providing a failure hint.
Unfortunately we do not have the time to cover all cases, so let us know if you want to know more
@@ -2081,7 +2080,7 @@ Unfortunately we do not have the time to cover all cases, so let us know if you
Do you want to write an own sophisticated assertion builder (or extend a current with more options) instead of an assertion function?
Great, we do not provide hands on documentation yet (had only one question about it so far).
Therefore, please have a look at the implementation, for instance how the sophisticated assertion builders for `Iterable<T>` are defined:
Notice that the implementation supports [Internationalization](#internationalization-1).
We are willing to provide more documentation if you need it (please open an issue).
@@ -2095,7 +2094,7 @@ Atrium offers three assertion verbs out of the box: `expect`, `assert` and `asse
But you can also define your own set of assertion verbs if they do not suite you or if you do not want that all of them are available in your classpath.
In order to create an own assertion verb it is sufficient to:
1. Copy the file content of [atriumVerbs.kt](https://github.com/robstoll/atrium/tree/master/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt)
1. Copy the file content of [atriumVerbs.kt](https://github.com/robstoll/atrium/tree/v0.10.0/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt)
2. Create your own atriumVerbs.kt and paste the previously copied content
-- notice that you can also use a `String` for the assertion verb in case you do not care about [Internationalization](#internationalization-1)
3. Adjust package name and `import`s and rename `expect` as desired (you can also leave it that way of course).
@@ -2136,7 +2135,7 @@ What are the drawbacks:
The `ReporterBuilder` lets you choose among different options to configure the style of the reporting.
For instance, in case you are not happy with the predefined bullet points, then you can change them via the `ReporterBuilder`.
Have a look at [atriumVerbs.kt of atrium-api-infix-en_GB](https://github.com/robstoll/atrium/tree/master/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/testutils/AsciiBulletPointReporterFactory.kt)
Have a look at [atriumVerbs.kt of atrium-api-infix-en_GB](https://github.com/robstoll/atrium/tree/v0.10.0/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/testutils/AsciiBulletPointReporterFactory.kt)
where you can find an example.
Or if you prefer multi-line reporting over single-line reporting,
@@ -2168,8 +2167,8 @@ It does not matter if you use your [own assertion verb](#use-own-assertion-verbs
You can provide your custom configured `Reporter` by providing a `ReporterFactory`.
This is done via [ServiceLoader](https://docs.oracle.com/javase/9/docs/api/java/util/ServiceLoader.html) -mechanism on JVM
and by calling `registerService` on JS where the call has to be before your tests run.
An example for JVM is given in [atriumVerbs.kt of atrium-api-infix-en_GB](https://github.com/robstoll/atrium/tree/master/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/testutils/AsciiBulletPointReporterFactory.kt).
An example of how you can make sure your code is called earlier than the tests run is given in [testSetup.kt of atrium-core-robstoll-lib](https://github.com/robstoll/atrium/tree/master/core/robstoll-lib/atrium-core-robstoll-lib-js/src/test/kotlin/testSetup.kt).
An example for JVM is given in [atriumVerbs.kt of atrium-api-infix-en_GB](https://github.com/robstoll/atrium/tree/v0.10.0/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/testutils/AsciiBulletPointReporterFactory.kt).
An example of how you can make sure your code is called earlier than the tests run is given in [testSetup.kt of atrium-core-robstoll-lib](https://github.com/robstoll/atrium/tree/v0.10.0/core/robstoll-lib/atrium-core-robstoll-lib-js/src/test/kotlin/testSetup.kt).
# Internationalization
@@ -2199,24 +2198,24 @@ enum class DescriptionIntAssertion(override val value: String) : StringBasedTran
Typically you would put `DescriptionIntAssertion` into an own module (jar)
so that it could be replaced (with zero performance cost) by another language representation.
Yet, a `Translator` uses a more enhanced fallback mechanism compared to a `ResourceBundle`.
For further technical information have a look at the KDoc of [Translator](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.reporting.translating/-translator/index.html).
For further technical information have a look at the KDoc of [Translator](https://docs.atriumlib.org/0.10.0/doc/ch.tutteli.atrium.reporting.translating/-translator/index.html).
Notice though, that we plan to move away from the `ResourceBundle`-inspired approach
due to enconding problems and missing implementations on other platforms than JVM.
Notice that the impl-function is not an extension function as before
because we do not want to pollute the API of `Expect<Int>` with this function.
In the above example we created a simple [DescriptiveAssertion](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.assertions/-descriptive-assertion/index.html)
In the above example we created a simple [DescriptiveAssertion](https://docs.atriumlib.org/0.10.0/doc/ch.tutteli.atrium.assertions/-descriptive-assertion/index.html)
(`createAndAddAssertion` does the same under the hood)
with a test which defines whether the assertion holds as well as a description (`IS_MULTIPLE_OF`) and a representation (`base`).
We suggest you use it as entry point (rather than memorizing different class names),
it guides you to existing assertion function implementations for different types
as well as to other builders such as the [`AssertionBuilder`](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.assertions.builders/-assertion-builder/index.html)
as well as to other builders such as the [`AssertionBuilder`](https://docs.atriumlib.org/0.10.0/doc/ch.tutteli.atrium.assertions.builders/-assertion-builder/index.html)
which in turn helps you with creating assertions.
In the API module we define the extension function and call the impl-function:
@@ -2335,17 +2334,17 @@ Both have their design focus on interoperability with code completion functional
-- so that you can let your IDE do some of the work.
Atrium is
[built up by different modules](https://docs.atriumlib.org/latest#/doc/)
[built up by different modules](https://docs.atriumlib.org/0.10.0/doc/)
and it is your choice which implementation you want to use.
However, this is more intended for advanced user with special requirements.
Atrium provides bundle modules which bundle API, translation, domain and core as well as predefined assertion verbs,
so that you just have to have a dependency on one of those bundles (kind a bit like a BOM pom in the maven world):
@@ -14,8 +14,8 @@ Yet with a few optimizations and adaptations:
This sample project defines a dependency on the bundle module `atrium-fluent-en_GB-robstoll-js`.
It does so by using a project dependency (this way CI builds it as well and we can be sure that we provide you a working example).
Therefore you need to delete line 28,29 in [build.gradle](https://github.com/robstoll/atrium/tree/master/samples/js/mocha/build.gradle#L28)
Therefore you need to delete line 28,29 in [build.gradle](https://github.com/robstoll/atrium/tree/v0.10.0/samples/js/mocha/build.gradle#L28)
and uncomment line 30.
Change line 4 in [build.gradle](https://github.com/robstoll/atrium/tree/master/samples/js/mocha/build.gradle#L4)
Change line 4 in [build.gradle](https://github.com/robstoll/atrium/tree/v0.10.0/samples/js/mocha/build.gradle#L4)
to `infix-en_GB-robstoll` in case you want to use the infix API.
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.