mirror of
https://github.com/jlengrand/atrium.git
synced 2026-03-10 08:01:19 +00:00
v0.17.0-RC1
This commit is contained in:
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@@ -12,7 +12,7 @@ Following a few guidelines so that others can quickly benefit from your contribu
|
||||
|
||||
## Code of Conduct
|
||||
This project and everyone participating in it is governed by Atrium's
|
||||
[Code of Conduct](https://github.com/robstoll/atrium/tree/master/.github/CODE_OF_CONDUCT.md).
|
||||
[Code of Conduct](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/.github/CODE_OF_CONDUCT.md).
|
||||
By participating, you are expected to uphold this code. Please report unacceptable behaviour to info@tutteli.ch
|
||||
|
||||
## How to Contribute
|
||||
|
||||
244
README.md
244
README.md
@@ -1,20 +1,20 @@
|
||||
<!-- for master -->
|
||||
|
||||
[](https://search.maven.org/artifact/ch.tutteli.atrium/atrium-fluent-en_GB)
|
||||
<!--
|
||||
[](https://search.maven.org/artifact/ch.tutteli.atrium/atrium-fluent-en_GB)
|
||||
[](https://joinup.ec.europa.eu/collection/eupl/eupl-text-11-12 "License")
|
||||
[](https://kotlinlang.slack.com/messages/atrium "See invitation link under section FAQ")
|
||||
[](https://github.com/robstoll/atrium/actions?query=workflow%3AUbuntu+branch%3Amaster)
|
||||
[](https://github.com/robstoll/atrium/actions?query=workflow%3AWindows+branch%3Amaster)
|
||||
[](https://codecov.io/github/robstoll/atrium/branch/master)
|
||||
[](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://search.maven.org/artifact/ch.tutteli.atrium/atrium-fluent-en_GB/0.16.0/jar)
|
||||
|
||||
[](https://search.maven.org/artifact/ch.tutteli.atrium/atrium-fluent-en_GB/0.17.0-RC1/jar)
|
||||
[](https://joinup.ec.europa.eu/collection/eupl/eupl-text-11-12 "License")
|
||||
[](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")
|
||||
-->
|
||||
|
||||
|
||||
# <img src="https://raw.githubusercontent.com/robstoll/atrium/gh-pages/logo.svg?sanitize=true" alt="Atrium" title="Atrium"/>
|
||||
Atrium is an open-source multiplatform assertion library for Kotlin with support for JVM, JS and Android.
|
||||
@@ -33,7 +33,7 @@ See [Examples](#examples) below to get a feel for how you could benefit from Atr
|
||||
---
|
||||
❗ You are taking a *sneak peek* at the next version.
|
||||
Please have a look at the README of the git tag in case you are looking for the documentation of the corresponding version.
|
||||
For instance, the [README of v0.16.0](https://github.com/robstoll/atrium/tree/v0.16.0/README.md).
|
||||
For instance, the [README of v0.17.0-RC1](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/README.md).
|
||||
|
||||
---
|
||||
|
||||
@@ -94,7 +94,7 @@ but can also be retrieved directly from [bintray](https://bintray.com/robstoll/t
|
||||
*gradle*:
|
||||
```
|
||||
buildscript {
|
||||
ext { atrium_version='0.16.0' }
|
||||
ext { atrium_version='0.17.0-RC1' }
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -106,8 +106,8 @@ dependencies {
|
||||
We have defined a dependency to the bundle `atrium-fluent-en_GB` in the above example
|
||||
which provides a pure fluent API (in en_GB) for the JVM platform.
|
||||
|
||||
Have a look at the [JVM sample projects](https://github.com/robstoll/atrium/tree/master/samples/jvm) for a quick setup, or
|
||||
[Maven sample project](https://github.com/robstoll/atrium/tree/master/samples/maven) if you prefer Maven to Gradle.
|
||||
Have a look at the [JVM sample projects](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples/jvm) for a quick setup, or
|
||||
[Maven sample project](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples/maven) if you prefer Maven to Gradle.
|
||||
|
||||
We currently provide the following extensions for the JVM platform:
|
||||
- kotlin_1_3: assertion functions for Kotlin 1.3 specific types (e.g. for [Result](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/index.html)).
|
||||
@@ -126,7 +126,7 @@ Also take a look at [Third-party Extensions](#third-party-extensions) which migh
|
||||
|
||||
```
|
||||
buildscript {
|
||||
ext { atrium_version='0.16.0' }
|
||||
ext { atrium_version='0.17.0-RC1' }
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -149,7 +149,7 @@ dependencies {
|
||||
|
||||
*maven*:
|
||||
Because maven is a bit more verbose than gradle, the example is not listed here but a
|
||||
[sample maven project](https://github.com/robstoll/atrium/tree/master/samples/maven)
|
||||
[sample maven project](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples/maven)
|
||||
is provided which shows all necessary setup.
|
||||
|
||||
That is all, you are all set. Jump to [Examples](#examples) which shows how to use Atrium.
|
||||
@@ -158,7 +158,7 @@ That is all, you are all set. Jump to [Examples](#examples) which shows how to u
|
||||
|
||||
```
|
||||
buildscript {
|
||||
ext { atrium_version='0.16.0' }
|
||||
ext { atrium_version='0.17.0-RC1' }
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -171,19 +171,19 @@ dependencies {
|
||||
We have defined a dependency to the bundle `atrium-fluent-en_GB-js` in the above example
|
||||
which provides a pure fluent API (in en_GB) for the JS platform.
|
||||
|
||||
Have a look at the [JS sample projects](https://github.com/robstoll/atrium/tree/master/samples/jvm) for a quick setup.
|
||||
Have a look at the [JS sample projects](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples/jvm) for a quick setup.
|
||||
|
||||
Otherwise, you need to setup an explicit dependency on `atrium-fluent-en_GB-js` in your test code in order that you can use Atrium.
|
||||
This is due to the loosely coupled design of Atrium and dead code elimination performed by the Kotlin compiler for JS.
|
||||
|
||||
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.17.0-RC1/build.gradle#L290))
|
||||
and has tests written in JS modules
|
||||
(see [AdjustStackTest](https://github.com/robstoll/atrium/tree/master/core/atrium-core-js/src/test/kotlin/ch/tutteli/atrium/reporting/erroradjusters/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.17.0-RC1/core/atrium-core-js/src/test/kotlin/ch/tutteli/atrium/reporting/erroradjusters/AdjustStackTest.kt))
|
||||
as well as tests written in common modules (e.g. [SmokeTest](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/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
|
||||
[build.gradle -> useJupiter](https://github.com/robstoll/atrium/tree/master/build.gradle#L342)).
|
||||
[build.gradle -> useJupiter](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/build.gradle#L342)).
|
||||
|
||||
We currently provide the following extensions for the JS platform:
|
||||
- kotlin_1_3: assertion functions for Kotlin 1.3 specific types (e.g. for [Result](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/index.html)).
|
||||
@@ -200,7 +200,7 @@ dependencies {
|
||||
|
||||
```
|
||||
buildscript {
|
||||
ext { atrium_version='0.16.0' }
|
||||
ext { atrium_version='0.17.0-RC1' }
|
||||
}
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -235,16 +235,16 @@ The setup for using Atrium in a common module of a multiplatform project is basi
|
||||
For instance `atrium-fluent-en_GB-common` instead of `atrium-fluent-en_GB`.
|
||||
|
||||
Have a look at [JVM](#jvm), [JS](#js) or [Android](#android) to see how the setup of a specific platform has to be done.
|
||||
You might want to have a look at the [Multiplatform sample project](https://github.com/robstoll/atrium/tree/master/samples/multiplatform)
|
||||
You might want to have a look at the [Multiplatform sample project](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples/multiplatform)
|
||||
as well for a quick setup.
|
||||
|
||||
# Examples
|
||||
We are using the API provided by the bundle module
|
||||
[atrium-fluent-en_GB](https://github.com/robstoll/atrium/tree/master/bundles/fluent-en_GB/atrium-fluent-en_GB/build.gradle)
|
||||
[atrium-fluent-en_GB](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/bundles/fluent-en_GB/atrium-fluent-en_GB/build.gradle)
|
||||
in the following examples.
|
||||
It provides a pure fluent API for the JVM platform.
|
||||
Have a look at
|
||||
[apis/differences.md](https://github.com/robstoll/atrium/tree/master/apis/differences.md)
|
||||
[apis/differences.md](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/apis/differences.md)
|
||||
to see how the infix API looks like, how they differ respectively.
|
||||
|
||||
## Your First Assertion
|
||||
@@ -259,7 +259,7 @@ import ch.tutteli.atrium.api.verbs.expect
|
||||
val x = 10
|
||||
expect(x).toEqual(9)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/FirstExampleSpec.kt#L31)</sub> ↓ <sub>[Output](#ex-first)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/FirstExampleSpec.kt#L31)</sub> ↓ <sub>[Output](#ex-first)</sub>
|
||||
<a name="ex-first"></a>
|
||||
```text
|
||||
expected that subject: 10 (kotlin.Int <1234789>)
|
||||
@@ -273,7 +273,7 @@ where `◆ ...` represents a single assertion for the subject (`10` in the above
|
||||
In this sense the report can be read as `I expected that the subject of the assertion, which is 10, equals 9`
|
||||
-- and needless to say, this assertion is wrong and thus the thrown error.
|
||||
|
||||
We are using the bundle [atrium-fluent-en_GB](https://github.com/robstoll/atrium/tree/master/bundles/fluent-en_GB/atrium-fluent-en_GB/build.gradle)
|
||||
We are using the bundle [atrium-fluent-en_GB](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/bundles/fluent-en_GB/atrium-fluent-en_GB/build.gradle)
|
||||
and the predefined expectation verb `expect` in the examples.
|
||||
Thus, the corresponding `import`s at the beginning of the file in the above example.
|
||||
We will omit the `import` statements in the remaining examples for brevity.
|
||||
@@ -290,7 +290,7 @@ The next section shows how you can define multiple assertions for the same subje
|
||||
// two single assertions, only first evaluated
|
||||
expect(4 + 6).toBeLessThan(5).toBeGreaterThan(10)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L24)</sub> ↓ <sub>[Output](#ex-single)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L24)</sub> ↓ <sub>[Output](#ex-single)</sub>
|
||||
<a name="ex-single"></a>
|
||||
```text
|
||||
expected that subject: 10 (kotlin.Int <1234789>)
|
||||
@@ -327,7 +327,7 @@ expect(4 + 6) {
|
||||
toBeGreaterThan(10)
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L40)</sub> ↓ <sub>[Output](#ex-group)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L40)</sub> ↓ <sub>[Output](#ex-group)</sub>
|
||||
<a name="ex-group"></a>
|
||||
```text
|
||||
expected that subject: 10 (kotlin.Int <1234789>)
|
||||
@@ -363,7 +363,7 @@ expect {
|
||||
throw IllegalArgumentException("name is empty")
|
||||
}.toThrow<IllegalStateException>()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L64)</sub> ↓ <sub>[Output](#ex-toThrow1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L64)</sub> ↓ <sub>[Output](#ex-toThrow1)</sub>
|
||||
<a name="ex-toThrow1"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$7$1 <1234789>)
|
||||
@@ -399,7 +399,7 @@ expect {
|
||||
throw IllegalArgumentException()
|
||||
}.toThrow<IllegalArgumentException>().message.toStartWith("firstName")
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L71)</sub> ↓ <sub>[Output](#ex-toThrow2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L71)</sub> ↓ <sub>[Output](#ex-toThrow2)</sub>
|
||||
<a name="ex-toThrow2"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$8$1 <1234789>)
|
||||
@@ -420,7 +420,7 @@ expect {
|
||||
message { toStartWith("firstName") }
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L77)</sub> ↓ <sub>[Output](#ex-toThrow3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L77)</sub> ↓ <sub>[Output](#ex-toThrow3)</sub>
|
||||
<a name="ex-toThrow3"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$9$1 <1234789>)
|
||||
@@ -444,7 +444,7 @@ expect {
|
||||
throw IllegalArgumentException("name is empty", RuntimeException("a cause"))
|
||||
}.notToThrow()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L85)</sub> ↓ <sub>[Output](#ex-notToThrow)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L85)</sub> ↓ <sub>[Output](#ex-notToThrow)</sub>
|
||||
<a name="ex-notToThrow"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$10$1 <1234789>)
|
||||
@@ -465,7 +465,7 @@ expected that subject: () -> kotlin.Nothing (readme.examples.MostExamples
|
||||
|
||||
Notice that stacks are filtered so that you only see what is of interest.
|
||||
Filtering can be configured via [`ReporterBuilder`](#reporterbuilder) by choosing an appropriate
|
||||
[AtriumErrorAdjuster](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.reporting/-atrium-error-adjuster/index.html).
|
||||
[AtriumErrorAdjuster](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.reporting/-atrium-error-adjuster/index.html).
|
||||
Stack frames of Atrium and of test runners (Spek, Kotlintest and JUnit for JVM, mocha and jasmine for JS) are excluded per default.
|
||||
[Create a Feature Request](https://github.com/robstoll/atrium/issues/new?template=feature_request.md&title=[Feature])
|
||||
in case you use a different runner, we can add yours to the list as well.
|
||||
@@ -507,7 +507,7 @@ expect(myPerson)
|
||||
.its { fullName() } // not evaluated anymore, subject String afterwards
|
||||
.toStartWith("rob") // not evaluated anymore
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L41)</sub> ↓ <sub>[Output](#ex-its-single)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L41)</sub> ↓ <sub>[Output](#ex-its-single)</sub>
|
||||
<a name="ex-its-single"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) (readme.examples.FeatureExtractorSpec$1$Person <1234789>)
|
||||
@@ -553,7 +553,7 @@ Feature assertions follow the common pattern of having two overloads:
|
||||
its { lastName }.toEqual("Dummy")
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L49)</sub> ↓ <sub>[Output](#ex-its-group)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L49)</sub> ↓ <sub>[Output](#ex-its-group)</sub>
|
||||
<a name="ex-its-group"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) (readme.examples.FeatureExtractorSpec$1$Person <1234789>)
|
||||
@@ -581,7 +581,7 @@ expect(myPerson)
|
||||
.feature { f(it::fullName) } // not evaluated anymore, subject String afterwards
|
||||
.toStartWith("rob") // not evaluated anymore
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L63)</sub> ↓ <sub>[Output](#ex-property-methods-single)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L63)</sub> ↓ <sub>[Output](#ex-property-methods-single)</sub>
|
||||
<a name="ex-property-methods-single"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) (readme.examples.FeatureExtractorSpec$1$Person <1234789>)
|
||||
@@ -622,7 +622,7 @@ expect(myPerson) { // forms an assertion group block
|
||||
feature { f(it::lastName) }.toEqual("Dummy")
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L71)</sub> ↓ <sub>[Output](#ex-property-methods-group)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L71)</sub> ↓ <sub>[Output](#ex-property-methods-group)</sub>
|
||||
<a name="ex-property-methods-group"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) (readme.examples.FeatureExtractorSpec$1$Person <1234789>)
|
||||
@@ -671,7 +671,7 @@ expect(myPerson)
|
||||
.toEqual("Robert aka. Stoll") // fails
|
||||
.toStartWith("llotS") // not evaluated anymore
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L85)</sub> ↓ <sub>[Output](#ex-methods-args)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L85)</sub> ↓ <sub>[Output](#ex-methods-args)</sub>
|
||||
<a name="ex-methods-args"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) (readme.examples.FeatureExtractorSpec$1$Person <1234789>)
|
||||
@@ -691,7 +691,7 @@ in case you miss a shortcut.
|
||||
<summary>💬 Write own feature assertion functions with additional checks.</summary>
|
||||
|
||||
Atrium provides a feature extractor which allows making feature assertions in a safe way in case the extraction is only valid for certain subjects.
|
||||
It is inter alia used for [`List.get`](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultListAssertions.kt#L13)
|
||||
It is inter alia used for [`List.get`](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultListAssertions.kt#L13)
|
||||
|
||||
</details>
|
||||
|
||||
@@ -713,7 +713,7 @@ expect(myFamily)
|
||||
.feature("first member's name") { members.first().name } // subject narrowed to String
|
||||
.toEqual("Peter")
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L102)</sub> ↓ <sub>[Output](#ex-arbitrary-features)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L102)</sub> ↓ <sub>[Output](#ex-arbitrary-features)</sub>
|
||||
<a name="ex-arbitrary-features"></a>
|
||||
```text
|
||||
expected that subject: Family(members=[FamilyMember(name=Robert)]) (readme.examples.FeatureExtractorSpec$1$Family <1234789>)
|
||||
@@ -763,7 +763,7 @@ expect(listOf(1 to "a", 2 to "b")).get(10) {
|
||||
firstToBe(1)
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L118)</sub> ↓ <sub>[Output](#ex-within-assertion-functions)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L118)</sub> ↓ <sub>[Output](#ex-within-assertion-functions)</sub>
|
||||
<a name="ex-within-assertion-functions"></a>
|
||||
```text
|
||||
expected that subject: [(1, a), (2, b)] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -851,7 +851,7 @@ expect(x).toBeAnInstanceOf<SubType1>()
|
||||
.feature { f(it::number) }
|
||||
.toEqual(2)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L92)</sub> ↓ <sub>[Output](#ex-type-assertions-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L92)</sub> ↓ <sub>[Output](#ex-type-assertions-1)</sub>
|
||||
<a name="ex-type-assertions-1"></a>
|
||||
```text
|
||||
expected that subject: SubType2(word=hello, flag=true) (readme.examples.SubType2 <1234789>)
|
||||
@@ -873,7 +873,7 @@ expect(x).toBeAnInstanceOf<SubType2> {
|
||||
feature { f(it::flag) }.toEqual(false)
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L98)</sub> ↓ <sub>[Output](#ex-type-assertions-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L98)</sub> ↓ <sub>[Output](#ex-type-assertions-2)</sub>
|
||||
<a name="ex-type-assertions-2"></a>
|
||||
```text
|
||||
expected that subject: SubType2(word=hello, flag=true) (readme.examples.SubType2 <1234789>)
|
||||
@@ -902,7 +902,7 @@ Let us look at the case where the subject of the assertion has a [nullable type]
|
||||
val slogan1: String? = "postulating assertions made easy"
|
||||
expect(slogan1).toEqual(null)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L106)</sub> ↓ <sub>[Output](#ex-nullable-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L106)</sub> ↓ <sub>[Output](#ex-nullable-1)</sub>
|
||||
<a name="ex-nullable-1"></a>
|
||||
```text
|
||||
expected that subject: "postulating assertions made easy" <1234789>
|
||||
@@ -916,7 +916,7 @@ expected that subject: "postulating assertions made easy" <1234789>
|
||||
val slogan2: String? = null
|
||||
expect(slogan2).toEqual("postulating assertions made easy")
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L110)</sub> ↓ <sub>[Output](#ex-nullable-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L110)</sub> ↓ <sub>[Output](#ex-nullable-2)</sub>
|
||||
<a name="ex-nullable-2"></a>
|
||||
```text
|
||||
expected that subject: null
|
||||
@@ -937,7 +937,7 @@ expect(slogan2) // subject has type String?
|
||||
.notToEqualNull() // subject is narrowed to String
|
||||
.toStartWith("atrium")
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L115)</sub> ↓ <sub>[Output](#ex-nullable-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L115)</sub> ↓ <sub>[Output](#ex-nullable-3)</sub>
|
||||
<a name="ex-nullable-3"></a>
|
||||
```text
|
||||
expected that subject: null
|
||||
@@ -954,7 +954,7 @@ one without (example above) and one with `assertionCreator`-lambda (example belo
|
||||
```kotlin
|
||||
expect(slogan2).notToEqualNull { toStartWith("atrium") }
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L120)</sub> ↓ <sub>[Output](#ex-nullable-4)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L120)</sub> ↓ <sub>[Output](#ex-nullable-4)</sub>
|
||||
<a name="ex-nullable-4"></a>
|
||||
```text
|
||||
expected that subject: null
|
||||
@@ -993,7 +993,7 @@ The following sub sections show both use cases by examples.
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 2, 4)).toContain(2, 3)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L124)</sub> ↓ <sub>[Output](#ex-collection-short-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L124)</sub> ↓ <sub>[Output](#ex-collection-short-1)</sub>
|
||||
<a name="ex-collection-short-1"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1031,7 +1031,7 @@ expect(listOf(1, 2, 2, 4)).toContain(
|
||||
{ toBeGreaterThan(2).toBeLessThan(4) }
|
||||
)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L128)</sub> ↓ <sub>[Output](#ex-collection-short-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L128)</sub> ↓ <sub>[Output](#ex-collection-short-2)</sub>
|
||||
<a name="ex-collection-short-2"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1073,7 +1073,7 @@ expect(listOf(1, 2, 3, 4)).toHaveElementsAndAny {
|
||||
toBeLessThan(0)
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L135)</sub> ↓ <sub>[Output](#ex-collection-any)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L135)</sub> ↓ <sub>[Output](#ex-collection-any)</sub>
|
||||
<a name="ex-collection-any"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1091,7 +1091,7 @@ expect(listOf(1, 2, 3, 4)).toHaveElementsAndNone {
|
||||
toBeGreaterThan(2)
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L140)</sub> ↓ <sub>[Output](#ex-collection-none)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L140)</sub> ↓ <sub>[Output](#ex-collection-none)</sub>
|
||||
<a name="ex-collection-none"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1111,7 +1111,7 @@ expect(listOf(1, 2, 3, 4)).toHaveElementsAndAll {
|
||||
toBeGreaterThan(2)
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L145)</sub> ↓ <sub>[Output](#ex-collection-all)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L145)</sub> ↓ <sub>[Output](#ex-collection-all)</sub>
|
||||
<a name="ex-collection-all"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1141,7 +1141,7 @@ Following on the last section we will start with an `inOrder` example:
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 2, 4)).toContain.inOrder.only.entries({ toBeLessThan(3) }, { toBeLessThan(2) })
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L151)</sub> ↓ <sub>[Output](#ex-collection-builder-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L151)</sub> ↓ <sub>[Output](#ex-collection-builder-1)</sub>
|
||||
<a name="ex-collection-builder-1"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1187,7 +1187,7 @@ expect(listOf(1, 2, 2, 4)).toContainExactly(
|
||||
report = { showOnlyFailingIfMoreElementsThan(3) }
|
||||
)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L154)</sub> ↓ <sub>[Output](#ex-collection-reportOptions-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L154)</sub> ↓ <sub>[Output](#ex-collection-reportOptions-1)</sub>
|
||||
<a name="ex-collection-reportOptions-1"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1218,7 +1218,7 @@ and we happily answer your question there.
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 2, 4)).toContain.inOrder.only.values(1, 2, 2, 3, 4)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L162)</sub> ↓ <sub>[Output](#ex-collection-builder-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L162)</sub> ↓ <sub>[Output](#ex-collection-builder-2)</sub>
|
||||
<a name="ex-collection-builder-2"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1243,7 +1243,7 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 2, 4)).toContain.inAnyOrder.atLeast(1).butAtMost(2).entries({ toBeLessThan(3) })
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L165)</sub> ↓ <sub>[Output](#ex-collection-builder-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L165)</sub> ↓ <sub>[Output](#ex-collection-builder-3)</sub>
|
||||
<a name="ex-collection-builder-3"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1260,7 +1260,7 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 2, 4)).toContain.inAnyOrder.only.values(1, 2, 3, 4)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L168)</sub> ↓ <sub>[Output](#ex-collection-builder-4)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L168)</sub> ↓ <sub>[Output](#ex-collection-builder-4)</sub>
|
||||
<a name="ex-collection-builder-4"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1279,7 +1279,7 @@ expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>
|
||||
```kotlin
|
||||
expect(listOf(1, 2, 2, 4)).toContain.inAnyOrder.only.values(4, 3, 2, 2, 1)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L171)</sub> ↓ <sub>[Output](#ex-collection-builder-5)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L171)</sub> ↓ <sub>[Output](#ex-collection-builder-5)</sub>
|
||||
<a name="ex-collection-builder-5"></a>
|
||||
```text
|
||||
expected that subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>)
|
||||
@@ -1309,7 +1309,7 @@ and more [Sophisticated Assertion Builder](#sophisticated-assertion-builders-1)
|
||||
```kotlin
|
||||
expect(mapOf("a" to 1, "b" to 2)).toContain("c" to 2, "a" to 1, "b" to 1)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L175)</sub> ↓ <sub>[Output](#ex-map-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L175)</sub> ↓ <sub>[Output](#ex-map-1)</sub>
|
||||
<a name="ex-map-1"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1333,7 +1333,7 @@ expect(mapOf("a" to 1, "b" to 2)).toContain(
|
||||
KeyValue("b") { toBeLessThan(2) }
|
||||
)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L178)</sub> ↓ <sub>[Output](#ex-map-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L178)</sub> ↓ <sub>[Output](#ex-map-2)</sub>
|
||||
<a name="ex-map-2"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1355,7 +1355,7 @@ Again both overloads are provided, one for key-value `Pair`s:
|
||||
```kotlin
|
||||
expect(mapOf("a" to 1, "b" to 2)).toContainOnly("b" to 2)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L186)</sub> ↓ <sub>[Output](#ex-map-only-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L186)</sub> ↓ <sub>[Output](#ex-map-only-1)</sub>
|
||||
<a name="ex-map-only-1"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1380,7 +1380,7 @@ expect(mapOf("a" to 1, "b" to 2)).toContainOnly(
|
||||
KeyValue("b") { toBeLessThan(2) }
|
||||
)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L189)</sub> ↓ <sub>[Output](#ex-map-only-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L189)</sub> ↓ <sub>[Output](#ex-map-only-2)</sub>
|
||||
<a name="ex-map-only-2"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1408,7 +1408,7 @@ again provide two overloads, one expecting key-value `Pair`s:
|
||||
```kotlin
|
||||
expect(mapOf("a" to 1, "b" to 2)).toContain.inOrder.only.entries("b" to 2, "a" to 1)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L197)</sub> ↓ <sub>[Output](#ex-map-builder-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L197)</sub> ↓ <sub>[Output](#ex-map-builder-1)</sub>
|
||||
<a name="ex-map-builder-1"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1435,7 +1435,7 @@ expect(mapOf("a" to 1, "b" to 2)).toContain.inOrder.only.entries(
|
||||
KeyValue("a") { toBeLessThan(2) },
|
||||
KeyValue("b") { toBeLessThan(2) })
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L200)</sub> ↓ <sub>[Output](#ex-map-builder-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L200)</sub> ↓ <sub>[Output](#ex-map-builder-2)</sub>
|
||||
<a name="ex-map-builder-2"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1472,7 +1472,7 @@ expect(mapOf("bernstein" to bernstein))
|
||||
feature { f(it::firstName) }.toEqual("Albert")
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L210)</sub> ↓ <sub>[Output](#ex-map-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L210)</sub> ↓ <sub>[Output](#ex-map-3)</sub>
|
||||
<a name="ex-map-3"></a>
|
||||
```text
|
||||
expected that subject: {bernstein=Person(firstName=Leonard, lastName=Bernstein, age=50)} (java.util.Collections.SingletonMap <1234789>)
|
||||
@@ -1492,7 +1492,7 @@ expect(mapOf("a" to 1, "b" to 2)) {
|
||||
values { toHaveElementsAndNone { toBeGreaterThan(1) } }
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L222)</sub> ↓ <sub>[Output](#ex-map-4)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L222)</sub> ↓ <sub>[Output](#ex-map-4)</sub>
|
||||
<a name="ex-map-4"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1528,7 +1528,7 @@ expect(linkedMapOf("a" to 1, "b" to 2)).asEntries().toContain.inOrder.only.entri
|
||||
}
|
||||
)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L228)</sub> ↓ <sub>[Output](#ex-map-5)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L228)</sub> ↓ <sub>[Output](#ex-map-5)</sub>
|
||||
<a name="ex-map-5"></a>
|
||||
```text
|
||||
expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
@@ -1549,7 +1549,7 @@ expected that subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>)
|
||||
`toEqualKeyValue` as well as `key` and `value` are assertion functions defined for `Map.Entry<K, V>`.
|
||||
|
||||
There are more assertion functions, a full list can be found in
|
||||
[KDoc of atrium-api-fluent-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.fluent.en_-g-b/index.html).
|
||||
[KDoc of atrium-api-fluent-en_GB](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.api.fluent.en_-g-b/index.html).
|
||||
|
||||
## Path Assertions
|
||||
|
||||
@@ -1561,7 +1561,7 @@ For example, `exists` will explain which entry was the first one missing:
|
||||
```kotlin
|
||||
expect(Paths.get("/usr/bin/noprogram")).toExist()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/PathSpec.kt#L37)</sub> ↓ <sub>[Output](#ex-path-exists)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/PathSpec.kt#L37)</sub> ↓ <sub>[Output](#ex-path-exists)</sub>
|
||||
<a name="ex-path-exists"></a>
|
||||
```text
|
||||
expected that subject: /usr/bin/noprogram (sun.nio.fs.UnixPath <1234789>)
|
||||
@@ -1577,7 +1577,7 @@ Atrium will give details about why something cannot be accessed, for example whe
|
||||
```kotlin
|
||||
expect(Paths.get("/root/.ssh/config")).toBeWritable()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/PathSpec.kt#L41)</sub> ↓ <sub>[Output](#ex-path-writable)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/PathSpec.kt#L41)</sub> ↓ <sub>[Output](#ex-path-writable)</sub>
|
||||
<a name="ex-path-writable"></a>
|
||||
```text
|
||||
expected that subject: /root/.ssh/config (sun.nio.fs.UnixPath <1234789>)
|
||||
@@ -1600,7 +1600,7 @@ val filePointer = Files.createSymbolicLink(directory.resolve("directory"), file)
|
||||
|
||||
expect(filePointer.resolve("subfolder/file")).toBeARegularFile()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/PathSpec.kt#L46)</sub> ↓ <sub>[Output](#ex-path-symlink-and-parent-not-folder)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/PathSpec.kt#L46)</sub> ↓ <sub>[Output](#ex-path-symlink-and-parent-not-folder)</sub>
|
||||
<a name="ex-path-symlink-and-parent-not-folder"></a>
|
||||
```text
|
||||
expected that subject: /tmp/atrium-path/directory/subfolder/file (sun.nio.fs.UnixPath <1234789>)
|
||||
@@ -1624,7 +1624,7 @@ expect("filename?")
|
||||
notToContain("?")
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L238)</sub> ↓ <sub>[Output](#ex-because-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L238)</sub> ↓ <sub>[Output](#ex-because-1)</sub>
|
||||
<a name="ex-because-1"></a>
|
||||
```text
|
||||
expected that subject: "filename?" <1234789>
|
||||
@@ -1679,7 +1679,7 @@ expect("calling myFun with...") {
|
||||
}
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/DataDrivenSpec.kt#L35)</sub> ↓ <sub>[Output](#ex-data-driven-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/DataDrivenSpec.kt#L35)</sub> ↓ <sub>[Output](#ex-data-driven-1)</sub>
|
||||
<a name="ex-data-driven-1"></a>
|
||||
```text
|
||||
expected that subject: "calling myFun with..." <1234789>
|
||||
@@ -1714,7 +1714,7 @@ expect("calling myFun with ...") {
|
||||
}
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/DataDrivenSpec.kt#L49)</sub> ↓ <sub>[Output](#ex-data-driven-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/DataDrivenSpec.kt#L49)</sub> ↓ <sub>[Output](#ex-data-driven-2)</sub>
|
||||
<a name="ex-data-driven-2"></a>
|
||||
```text
|
||||
expected that subject: "calling myFun with ..." <1234789>
|
||||
@@ -1755,7 +1755,7 @@ expect("calling myNullableFun with ...") {
|
||||
}
|
||||
}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/DataDrivenSpec.kt#L67)</sub> ↓ <sub>[Output](#ex-data-driven-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/DataDrivenSpec.kt#L67)</sub> ↓ <sub>[Output](#ex-data-driven-3)</sub>
|
||||
<a name="ex-data-driven-3"></a>
|
||||
```text
|
||||
expected that subject: "calling myNullableFun with ..." <1234789>
|
||||
@@ -1772,21 +1772,21 @@ expected that subject: "calling myNullableFun with ..." <1234789>
|
||||
|
||||
Atrium supports further assertion builders (e.g, for `CharSequence`)
|
||||
as well as assertion functions which have not been shown in the examples.
|
||||
Have a look at [apis/differences.md](https://github.com/robstoll/atrium/tree/master/apis/differences.md) for a few more examples.
|
||||
Have a look at [apis/differences.md](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/apis/differences.md) for a few more examples.
|
||||
This site contains also a list of all APIs with links to their assertion function catalogs.
|
||||
|
||||
You can also have a look at the
|
||||
[specifications](https://github.com/robstoll/atrium/tree/master/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs)
|
||||
[specifications](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs)
|
||||
for more examples.
|
||||
|
||||
## Sample Projects
|
||||
|
||||
Have a look into the [samples](https://github.com/robstoll/atrium/tree/master/samples)
|
||||
Have a look into the [samples](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples)
|
||||
folder, it currently contains sample projects for
|
||||
- [jvm gradle](https://github.com/robstoll/atrium/tree/master/samples/jvm/)
|
||||
- [maven](https://github.com/robstoll/atrium/tree/master/samples/maven/)
|
||||
- [js](https://github.com/robstoll/atrium/tree/master/samples/js/)
|
||||
- [multiplatform project](https://github.com/robstoll/atrium/tree/master/samples/multiplatform/)
|
||||
- [jvm gradle](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples/jvm/)
|
||||
- [maven](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples/maven/)
|
||||
- [js](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples/js/)
|
||||
- [multiplatform project](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/samples/multiplatform/)
|
||||
|
||||
Are you using a different runner? A PR would be appreciated 😊.
|
||||
|
||||
@@ -1827,7 +1827,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 toEqual](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 toEqual](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.api.cc.en_-g-b/to-be.html).
|
||||
|
||||
</details>
|
||||
|
||||
@@ -1900,7 +1900,7 @@ expect {
|
||||
}
|
||||
}.toThrow<IllegalStateException> { messageToContain("no no no") }
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L251)</sub> ↓ <sub>[Output](#ex-add-info-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L251)</sub> ↓ <sub>[Output](#ex-add-info-3)</sub>
|
||||
<a name="ex-add-info-3"></a>
|
||||
```text
|
||||
expected that subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$40$1 <1234789>)
|
||||
@@ -1942,7 +1942,7 @@ then Atrium reminds us of the possible pitfall. For instance:
|
||||
```kotlin
|
||||
expect(BigDecimal.TEN).toEqualIncludingScale(BigDecimal("10.0"))
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L261)</sub> ↓ <sub>[Output](#ex-pitfall-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L261)</sub> ↓ <sub>[Output](#ex-pitfall-1)</sub>
|
||||
<a name="ex-pitfall-1"></a>
|
||||
```text
|
||||
expected that subject: 10 (java.math.BigDecimal <1234789>)
|
||||
@@ -1960,7 +1960,7 @@ For instance:
|
||||
```kotlin
|
||||
expect(listOf(1)).get(0) {}
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L264)</sub> ↓ <sub>[Output](#ex-pitfall-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L264)</sub> ↓ <sub>[Output](#ex-pitfall-2)</sub>
|
||||
<a name="ex-pitfall-2"></a>
|
||||
```text
|
||||
expected that subject: [1] (java.util.Collections.SingletonList <1234789>)
|
||||
@@ -2039,7 +2039,7 @@ and its usage:
|
||||
```kotlin
|
||||
expect(12).toBeAMultipleOf(5)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L44)</sub> ↓ <sub>[Output](#ex-own-boolean-1)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L44)</sub> ↓ <sub>[Output](#ex-own-boolean-1)</sub>
|
||||
<a name="ex-own-boolean-1"></a>
|
||||
```text
|
||||
expected that subject: 12 (kotlin.Int <1234789>)
|
||||
@@ -2055,9 +2055,9 @@ Let us see how we actually defined `toBeAMultipleOf`.
|
||||
the assertion to itself (creating alone is not enough, it needs to be added in order that it is evaluated).
|
||||
The method `createAndAddAssertion` returns itself (the same `Expect`) making it easy for you to provide a fluent API as well.
|
||||
|
||||
The method [createAndAddAssertion](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.creating/-assertion-plant/create-and-add-assertion.html)
|
||||
The method [createAndAddAssertion](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.creating/-assertion-plant/create-and-add-assertion.html)
|
||||
expects:
|
||||
- a either a `String` or a [Translatable](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.reporting.translating/-translatable/index.html)
|
||||
- a either a `String` or a [Translatable](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.reporting.translating/-translatable/index.html)
|
||||
as description of your assertion.
|
||||
- the representation of the expected value.
|
||||
- and the actual check as lambda where you typically use `it` which refers to the subject of the assertion.
|
||||
@@ -2082,7 +2082,7 @@ fun Expect<Int>.toBeEven() =
|
||||
```
|
||||
</code-own-boolean-2>
|
||||
|
||||
We are using a [Text](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.reporting/-text/index.html)
|
||||
We are using a [Text](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.reporting/-text/index.html)
|
||||
here so that `"an even number"` is not treated as a `String` in reporting.
|
||||
Its usage looks then as follows:
|
||||
|
||||
@@ -2091,7 +2091,7 @@ Its usage looks then as follows:
|
||||
```kotlin
|
||||
expect(13).toBeEven()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L57)</sub> ↓ <sub>[Output](#ex-own-boolean-2)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L57)</sub> ↓ <sub>[Output](#ex-own-boolean-2)</sub>
|
||||
<a name="ex-own-boolean-2"></a>
|
||||
```text
|
||||
expected that subject: 13 (kotlin.Int <1234789>)
|
||||
@@ -2192,7 +2192,7 @@ Its usage is then as follows:
|
||||
expect(Person("Susanne", "Whitley", 43, listOf()))
|
||||
.toHaveNumberOfChildren(2)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L74)</sub> ↓ <sub>[Output](#ex-own-compose-3)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L74)</sub> ↓ <sub>[Output](#ex-own-compose-3)</sub>
|
||||
<a name="ex-own-compose-3"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[]) (readme.examples.Person <1234789>)
|
||||
@@ -2228,7 +2228,7 @@ I.e. it fails for a `Person` with 0 children, because such a person does not hav
|
||||
expect(Person("Susanne", "Whitley", 43, listOf()))
|
||||
.toHaveAdultChildren()
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L91)</sub> ↓ <sub>[Output](#ex-own-compose-4)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L91)</sub> ↓ <sub>[Output](#ex-own-compose-4)</sub>
|
||||
<a name="ex-own-compose-4"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[]) (readme.examples.Person <1234789>)
|
||||
@@ -2278,7 +2278,7 @@ expect(Person("Susanne", "Whitley", 43, listOf(Person("Petra", "Whitley", 12, li
|
||||
.children // using the val -> subsequent assertions are about children and fail fast
|
||||
.toHaveSize(2)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L101)</sub> ↓ <sub>[Output](#ex-own-compose-5)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L101)</sub> ↓ <sub>[Output](#ex-own-compose-5)</sub>
|
||||
<a name="ex-own-compose-5"></a>
|
||||
```text
|
||||
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[Person(firstName=Petra, lastName=Whitley, age=12, children=[])]) (readme.examples.Person <1234789>)
|
||||
@@ -2340,7 +2340,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.logic.utils/-argument-mapper-builder/index.html).
|
||||
See [KDoc of ArgumentMapperBuilder](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.logic.utils/-argument-mapper-builder/index.html).
|
||||
In case you want to provide your own implementation,
|
||||
it suffices to create an extension function for `ArgumentMapperBuilder`.
|
||||
|
||||
@@ -2350,20 +2350,20 @@ it suffices to create an extension function for `ArgumentMapperBuilder`.
|
||||
Yet, sometimes we would like to create functions which have a better error reporting than the one we get
|
||||
when we compose assertion functions.
|
||||
|
||||
[`_logic`](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logic.kt#L21)
|
||||
[`_logic`](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/logic.kt#L21)
|
||||
is the entry point to `AssertionContainer` which is the equivalent of `Expect` but on a lower level.
|
||||
|
||||
Following a quick overview what extension methods could be useful:
|
||||
- all assertion functions on the logic 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.
|
||||
- `changeSubject` which allows to change the subject either:
|
||||
- `unreported`; meaning it does not show up in reporting (e.g. `Expect<Array<out T>>.asList()` 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/fluent/en_GB/arrayAssertions.kt#L19))
|
||||
- reported, using `reportBuilder`; meaning a subject transformation which is shown in reporting as it incorporates a transformation (e.g. `toBeA` uses it, see [AnyAssertions](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultAnyAssertions.kt#L52))
|
||||
- `collect` which allows to collect assertions - especially helpful in composing assertions (see [mapAssertions](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultMapAssertions.kt#L49))
|
||||
- `extractFeature` for feature assertions which are not always save to extract (see [`List.get`](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultListAssertions.kt#L13))
|
||||
- `unreported`; meaning it does not show up in reporting (e.g. `Expect<Array<out T>>.asList()` uses it, see [arrayAssertions](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/arrayAssertions.kt#L19))
|
||||
- reported, using `reportBuilder`; meaning a subject transformation which is shown in reporting as it incorporates a transformation (e.g. `toBeA` uses it, see [AnyAssertions](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultAnyAssertions.kt#L52))
|
||||
- `collect` which allows to collect assertions - especially helpful in composing assertions (see [mapAssertions](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultMapAssertions.kt#L49))
|
||||
- `extractFeature` for feature assertions which are not always save to extract (see [`List.get`](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultListAssertions.kt#L13))
|
||||
|
||||
Besides, the `assertionBuilder` allows 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)
|
||||
(see [AssertionBuilder](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.assertions.builders/-assertion-builder/index.html) for more information)
|
||||
which can be used to create very specific assertion functions.
|
||||
|
||||
You can find an example in [floatingPointAssertions](https://github.com/robstoll/atrium/blob/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultFloatingPointAssertions.kt#L72)
|
||||
@@ -2388,7 +2388,7 @@ Atrium offers the expectation verb `expect` out of the box.
|
||||
|
||||
You can also define your own expectation verb if `expect` does not suite you or in case you want to change some default implementation.
|
||||
In order to create an own expectation 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.17.0-RC1/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 expectation 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).
|
||||
@@ -2426,7 +2426,7 @@ What are the drawbacks:
|
||||
## Use own Components
|
||||
|
||||
Replacing existing components with your own (or third-party) components can be done when specifying an own expectation verb
|
||||
via `withOptions`. See for instance [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#L31)
|
||||
via `withOptions`. See for instance [atriumVerbs.kt](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt#L31)
|
||||
which is used internally of Atrium in tests and uses a different `AtriumErrorAdjuster`.
|
||||
|
||||
Another example, say you prefer multi-line reporting over single-line reporting,
|
||||
@@ -2459,7 +2459,7 @@ Following an example using the expectation verb
|
||||
```kotlin
|
||||
expect(10).toEqual(9)
|
||||
```
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationVerbSpec.kt#L51)</sub> ↓ <sub>[Output](#ex-own-expectation-verb)</sub>
|
||||
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationVerbSpec.kt#L51)</sub> ↓ <sub>[Output](#ex-own-expectation-verb)</sub>
|
||||
<a name="ex-own-expectation-verb"></a>
|
||||
```text
|
||||
expected the subject:
|
||||
@@ -2479,7 +2479,7 @@ You prefer another reporting style but Atrium does not yet support it?
|
||||
Please let us know it by [writing a feature request](https://github.com/robstoll/atrium/issues/new?template=feature_request.md&title=[Feature]).
|
||||
|
||||
There are more options to choose from. Take a look at the
|
||||
[DefaultComponentFactoryContainer](https://github.com/robstoll/atrium/tree/master/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/ComponentFactoryContainerImpl.kt#L121)
|
||||
[DefaultComponentFactoryContainer](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/creating/impl/ComponentFactoryContainerImpl.kt#L121)
|
||||
to see the default configuration.
|
||||
|
||||
# Internationalization
|
||||
@@ -2515,24 +2515,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.
|
||||
For instance,
|
||||
[atrium-fluent-en_GB-common](https://github.com/robstoll/atrium/tree/master/bundles/fluent-en_GB/atrium-fluent-en_GB-common/build.gradle)
|
||||
[atrium-fluent-en_GB-common](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/bundles/fluent-en_GB/atrium-fluent-en_GB-common/build.gradle)
|
||||
uses `atrium-translations-en_GB-common` whereas
|
||||
tests of
|
||||
[atrium-infix_en_GB-common](https://github.com/robstoll/atrium/tree/master/bundles/infix-en_GB/atrium-infix-en_GB-common/build.gradle)
|
||||
[atrium-infix_en_GB-common](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/bundles/infix-en_GB/atrium-infix-en_GB-common/build.gradle)
|
||||
uses `atrium-translations-de_CH-common`.
|
||||
|
||||
<details>
|
||||
<summary>💬 Using a TranslationSupplier</summary>
|
||||
|
||||
Next to providing translations via code you can also use a
|
||||
[TranslationSupplier](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.reporting.translating/-translation-supplier/index.html)
|
||||
based [Translator](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.reporting.translating/-translator/index.html)
|
||||
[TranslationSupplier](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.reporting.translating/-translation-supplier/index.html)
|
||||
based [Translator](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.reporting.translating/-translator/index.html)
|
||||
by configuring the [`ReporterBuilder`](#reporterbuilder) accordingly (e.g. use `withDefaultTranslationSupplier` instead of `withoutTranslations`).
|
||||
Atrium supports a properties files based `TranslationSupplier` for JVM (a supplier for JS will follow) which is more or less what
|
||||
[ResourceBundle](https://docs.oracle.com/javase/tutorial/i18n/resbundle/propfile.html)
|
||||
provides out of the box.
|
||||
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.17.0-RC1/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.
|
||||
|
||||
@@ -2579,7 +2579,7 @@ We split up the function in two parts: API and logic
|
||||
merely appends the assertion created by the logic to the `Expect`.
|
||||
|
||||
Typically, you put the API function in one module (jar) and the logic in another (so that the API can be exchanged).
|
||||
In the logic module we define and extension method for [AssertionContainer](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.creating/-assertion-container/index.html)
|
||||
In the logic module we define and extension method for [AssertionContainer](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.creating/-assertion-container/index.html)
|
||||
|
||||
<code-i18n-3a>
|
||||
|
||||
@@ -2591,7 +2591,7 @@ fun AssertionContainer<Int>.toBeAMultipleOf(base: Int): Assertion =
|
||||
```
|
||||
</code-i18n-3a>
|
||||
|
||||
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.17.0-RC1/doc/ch.tutteli.atrium.assertions/-descriptive-assertion/index.html)
|
||||
with the help of `createDescriptiveAssertion` defined on AssertionContainer.
|
||||
We pass in a description (`TO_BE_A_MULTIPLE_OF`), use `base` as representation of the assertion
|
||||
and defined a lambda which implements a test to define whether the assertion holds or not.
|
||||
@@ -2631,17 +2631,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.17.0-RC1/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, logic, core, translation as well as predefined expectation 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):
|
||||
|
||||
- [atrium-fluent-en_GB](https://github.com/robstoll/atrium/tree/master/bundles/fluent-en_GB/atrium-fluent-en_GB-common/build.gradle)
|
||||
- [atrium-infix-en_GB](https://github.com/robstoll/atrium/tree/master/bundles/infix-en_GB/atrium-infix-en_GB-common/build.gradle)
|
||||
- [atrium-fluent-en_GB](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/bundles/fluent-en_GB/atrium-fluent-en_GB-common/build.gradle)
|
||||
- [atrium-infix-en_GB](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/bundles/infix-en_GB/atrium-infix-en_GB-common/build.gradle)
|
||||
|
||||
Have a look at
|
||||
[apis/differences.md](https://github.com/robstoll/atrium/tree/master/apis/differences.md)
|
||||
[apis/differences.md](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/apis/differences.md)
|
||||
for more information and to see how the API styles differ.
|
||||
|
||||
|
||||
@@ -2656,15 +2656,15 @@ Therefore, you want to turn the platform type into the nullable version.
|
||||
|
||||
You need to use a cast to do this. But depending on your return type this might be cumbersome especially if you deal with type parameters.
|
||||
Thus, Atrium provides the following functions to ease dealing with Java Code at least for some standard cases:
|
||||
- [`nullable`](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L19)
|
||||
- [`nullable`](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L19)
|
||||
turns a type into a nullable type.
|
||||
- [`nullableContainer`](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L40)
|
||||
- [`nullableContainer`](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L40)
|
||||
turns an `Iterable` into an iterable with nullable element type, likewise it does the same for `Array`.
|
||||
- [`nullableKeyMap`](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L66)
|
||||
- [`nullableKeyMap`](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L66)
|
||||
turns a `Map` into a map with a nullable key type.
|
||||
- [`nullableValueMap`](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L79)
|
||||
- [`nullableValueMap`](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L79)
|
||||
turns a `Map` into a map with a nullable value type.
|
||||
- [`nullableKeyValueMap`](https://github.com/robstoll/atrium/tree/master/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L92)
|
||||
- [`nullableKeyValueMap`](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L92)
|
||||
turns a `Map` into a map with a nullable key and nullable value type.
|
||||
|
||||
|
||||
@@ -2720,8 +2720,8 @@ expect(sequenceOf(1, 2, 3)).feature { f(it::asIterable) }.toContain(2)
|
||||
## Where do I find a list of all available functions?
|
||||
|
||||
Atrium provides KDoc for all APIs - have a look at their KDoc:
|
||||
- [atrium-api-fluent-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.fluent.en_-g-b/index.html)
|
||||
- [atrium-api-infix-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.infix.en_-g-b/index.html)
|
||||
- [atrium-api-fluent-en_GB](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.api.fluent.en_-g-b/index.html)
|
||||
- [atrium-api-infix-en_GB](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.api.infix.en_-g-b/index.html)
|
||||
|
||||
## Problems in conjunction with `feature`
|
||||
|
||||
@@ -2757,7 +2757,7 @@ You are more than welcome to contribute as well:
|
||||
if you would like to code (ping us on [Slack](https://kotlinlang.slack.com/messages/C887ZKGCQ) if there are not any).
|
||||
|
||||
Please have a look at
|
||||
[CONTRIBUTING.md](https://github.com/robstoll/atrium/tree/master/.github/CONTRIBUTING.md)
|
||||
[CONTRIBUTING.md](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/.github/CONTRIBUTING.md)
|
||||
for further suggestions and guidelines.
|
||||
|
||||
# Sponsors
|
||||
|
||||
@@ -12,13 +12,13 @@ These modules bundle:
|
||||
Following a list of the available bundle-modules.
|
||||
The links point to the KDoc of their included API where you find an overview of all available expectation functions of the API.
|
||||
|
||||
- [atrium-fluent-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.fluent.en_-g-b/index.html)
|
||||
- [atrium-infix-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.infix.en_-g-b/index.html)
|
||||
- [atrium-fluent-en_GB](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.api.fluent.en_-g-b/index.html)
|
||||
- [atrium-infix-en_GB](https://docs.atriumlib.org/0.17.0-RC1/doc/ch.tutteli.atrium.api.infix.en_-g-b/index.html)
|
||||
|
||||
----
|
||||
|
||||
Following an excerpt of a build.gradle file which uses twit APIs (see
|
||||
[README#Installation](https://github.com/robstoll/atrium/tree/master/README.md#installation)
|
||||
[README#Installation](https://github.com/robstoll/atrium/tree/v0.17.0-RC1/README.md#installation)
|
||||
for the rest):
|
||||
```
|
||||
dependencies {
|
||||
|
||||
@@ -56,7 +56,7 @@ buildscript {
|
||||
ghPages_version = rootProject.version
|
||||
srcKotlin = 'src/main/kotlin'
|
||||
github_url = "https://github.com/robstoll/${rootProject.name}"
|
||||
dokka_sourceMapping = "tree/master"
|
||||
dokka_sourceMapping = "tree/v0.17.0-RC1"
|
||||
|
||||
|
||||
toolProjects = toolProjectsFun
|
||||
@@ -415,8 +415,8 @@ Release & deploy a commit
|
||||
|
||||
Either use the following commands or the manual steps below
|
||||
|
||||
export ATRIUM_PREVIOUS_VERSION=0.16.0
|
||||
export ATRIUM_VERSION=0.17.0
|
||||
export ATRIUM_PREVIOUS_VERSION=0.17.0-RC1
|
||||
export ATRIUM_VERSION=0.17.0-RC1
|
||||
find ./ -name "*.md" | xargs perl -0777 -i \
|
||||
-pe "s@$ATRIUM_PREVIOUS_VERSION@$ATRIUM_VERSION@g;" \
|
||||
-pe "s@tree/master@tree/v$ATRIUM_VERSION@g;" \
|
||||
@@ -494,7 +494,7 @@ Prepare next dev cycle
|
||||
|
||||
Either use the following commands or the manual steps below
|
||||
|
||||
export ATRIUM_VERSION=0.16.0
|
||||
export ATRIUM_VERSION=0.17.0-RC1
|
||||
export ATRIUM_NEXT_VERSION=0.17.0
|
||||
find ./ -name "*.md" | xargs perl -0777 -i \
|
||||
-pe "s@tree/v$ATRIUM_VERSION@tree/master@g;" \
|
||||
|
||||
Reference in New Issue
Block a user