diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b36bac6358..b8d2b934a4 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -31,14 +31,14 @@ By participating, you are expected to uphold this code. Please report unacceptab - Missing a feature? [Create a feature request](https://github.com/robstoll/atrium/issues/new?template=feature_request.md&title=[Feature]). -- You would like to write an assertion function but you're having trouble starting? +- You would like to write an expectation function but you are having trouble starting? Please read the section [Your First Code Contribution](#your-first-code-contribution). If you still have trouble starting, then contact us on [slack](https://kotlinlang.slack.com/messages/D3CL4DDLG/) ([Invite yourself](https://slack.kotlinlang.org/) in case you do not have an account yet) and we will try to give you some additional hints. -- You do not have a particular assertion function in mind but would like to contribute with code? +- You do not have a particular expectation function in mind but would like to contribute with code? Please have a look at the [help wanted issues](https://github.com/robstoll/atrium/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) -- ping us on [Slack](https://kotlinlang.slack.com/messages/C887ZKGCQ) @@ -54,7 +54,7 @@ By participating, you are expected to uphold this code. Please report unacceptab - Found spelling mistakes? Nice catch :mag: Please fix it and create a pull request. -- You wrote an assertion function and would like to contribute it to Atrium? +- You wrote an expectation function and would like to contribute it to Atrium? Awesome :+1: please review the [pull request checklist](#pull-request-checklist) and create a pull request - You would like to support the project financially? diff --git a/README.md b/README.md index 4b1675ef11..09fff900af 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,14 @@ --> # Atrium -Atrium is an open-source multiplatform assertion library for Kotlin with support for JVM, JS and Android. +Atrium is an open-source multiplatform expectation/assertion library for Kotlin with support for JVM, JS and Android. It is designed to support multiple [APIs](#api-styles), different error reporting styles and [Internationalization](#internationalization-1) (i18n). The project was inspired by AssertJ at first but moved on and provides now more flexibility, features and hints to its users (so to you 😉). Atrium is designed to be extensible as well as configurable -and allows you to extend it with your own assertion functions, customise reporting -or even replace core components with your own implementation in an easy way. +and allows you to extend it with your own expectation functions, customise reporting +or even replace core components with your own implementation easily. Atrium currently provides two [API Styles](#api-styles): pure fluent and infix where both of them have their design focus on usability in conjunction with code completion functionality provided by your IDE. @@ -44,33 +44,33 @@ For instance, the [README of v0.18.0](https://github.com/robstoll/atrium/tree/v0 - [Android](#android) - [Common](#common) - [Examples](#examples) - - [Your First Assertion](#your-first-assertion) - - [Define Single Assertions or Assertion Groups](#define-single-assertions-or-assertion-groups) + - [Your First Expectation](#your-first-expectation) + - [Define Single Expectations or an Expectation-Group](#define-single-expectations-or-an-expectation-group) - [Expect an Exception](#expect-an-exception) - - [Feature Assertions](#feature-assertions) + - [Feature Extractors](#feature-extractors) - [Property and Method](#property-and-methods) - [Arbitrary Features](#arbitrary-features) - - [Type Assertions](#type-assertions) + - [Type Expectations](#type-expectations) - [Nullable Types](#nullable-types) - - [Collection Assertions](#collection-assertions) + - [Collection Expectations](#collection-expectations) - [Shortcut Functions](#shortcut-functions) - - [Sophisticated Assertion Builders](#sophisticated-assertion-builders) - - [Map Assertions](#map-assertions) + - [Sophisticated Expectation Builders](#sophisticated-expectation-builders) + - [Map Expectations](#map-expectations) - [Shortcut Functions](#shortcut-functions-1) - - [Sophisticated Assertion Builders](#sophisticated-assertion-builders-1) + - [Sophisticated Expectation Builders](#sophisticated-expectation-builders-1) - [Others](#others) - - [Path Assertions](#path-assertions) + - [Path Expectations](#path-expectations) - [Attaching a Reason](#attaching-a-reason) - [Data Driven Testing](#data-driven-testing) - [Further Examples](#further-examples) - [Sample Projects](#sample-projects) - [Third-party Extensions](#third-party-extensions) -- [How is Atrium different from other Assertion Libraries](#how-is-atrium-different-from-other-assertion-libraries) -- [Write own Assertion Functions](#write-own-assertion-functions) - - [Boolean based Assertions](#boolean-based-assertions) - - [Compose Functions](#compose-assertion-functions) +- [How is Atrium different from other Expectation/Assertion Libraries](#how-is-atrium-different-from-other-expectationassertion-libraries) +- [Write own Expectation Functions](#write-own-expectation-functions) + - [Boolean based Expectation Functions](#boolean-based-expectation-functions) + - [Compose Functions](#compose-expectation-functions) - [Enhanced Reporting](#enhanced-reporting) - - [Own Sophisticated Assertion Builders](#own-sophisticated-assertion-builders) + - [Own Sophisticated Expectation Builders](#own-sophisticated-expectation-builders) - [Use own Expectation Verb](#use-own-expectation-verb) - [Use own Components](#use-own-components) - [Internationalization](#internationalization-1) @@ -106,7 +106,7 @@ Have a look at the [JVM sample projects](https://github.com/robstoll/atrium/tree [Maven sample project](https://github.com/robstoll/atrium/tree/main/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)). +- kotlin_1_3: expectation functions for Kotlin 1.3 specific types (e.g. for [Result](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/index.html)). You can enable them as follows: ``` @@ -179,7 +179,7 @@ which are executed on the JS platform as well [build.gradle -> useJupiter](https://github.com/robstoll/atrium/tree/main/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)). + - kotlin_1_3: expectation functions for Kotlin 1.3 specific types (e.g. for [Result](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/index.html)). You can enable them as follows: ``` @@ -214,8 +214,8 @@ That is all, you are all set. Jump to [Examples](#examples) which shows how to u ## Android -Starting with 0.12.0 we no longer deliver a dedicated `-android` jar. Instead you can use the same setup as shown in [JVM setup](#jvm). -We start adding one again in case we have Android specific assertion functions. +Starting with 0.12.0 we no longer deliver a dedicated `-android` jar. Instead, you can use the same setup as shown in [JVM setup](#jvm). +We start adding one again in case we have Android specific expectation functions. Also take a look at [Third-party Extensions](#third-party-extensions) which might come in handy as well. @@ -238,7 +238,7 @@ Have a look at [apis/differences.md](https://github.com/robstoll/atrium/tree/main/apis/differences.md) to see how the infix API looks like, how they differ respectively. -## Your First Assertion +## Your First Expectation We start off with a simple example: @@ -258,11 +258,12 @@ I expected subject: 10 (kotlin.Int <1234789>) ``` -The statement can be read as "I expect x to equal nine" where an equality check is used (for an identity check, you have to use `toBeTheSameInstace`). +The statement can be read as "I expect x to equal nine" where an equality check is used (for an identity check, you would have to use `toBeTheSameInstace`). Since this is false, an `AssertionError` is thrown with a corresponding message as shown in the [Output](#ex-first) -where `◆ ...` represents a single assertion for the subject (`10` in the above example) of the assertion. -In this sense the report can be read as `I expected the subject of the assertion, which was 10, to equal 9` --- and needless to say, this assertion is wrong and thus the thrown error. +where on the first line the actual subject (`10` in the above example) is shown and on following lines which start with, +`◆ ...` (here only one) we see the expectations we had about the subject +In this sense the report can be read as `I expected the subject of the expectation, which was 10, to equal 9` +-- and needlessly to say, this expectation was not met and thus the thrown error. We are using the bundle [atrium-fluent-en_GB](https://github.com/robstoll/atrium/tree/main/bundles/fluent-en_GB/atrium-fluent-en_GB/build.gradle) and the predefined expectation verb `expect` in the examples. @@ -272,13 +273,13 @@ We will omit the `import` statements in the remaining examples for brevity. **You want to run the examples yourself?** Have a look at the [Installation](#installation) section which explains how to set up a dependency to Atrium. -The next section shows how you can define multiple assertions for the same subject. +The next section shows how you can define multiple expectations for the same subject. -## Define Single Assertions or Assertion Groups +## Define Single Expectations or an Expectation-Group ```kotlin -// two single assertions, only first evaluated +// two single expectations, only first evaluated expect(4 + 6).toBeLessThan(5).toBeGreaterThan(10) ``` ↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L24)[Output](#ex-single) @@ -289,9 +290,9 @@ I expected subject: 10 (kotlin.Int <1234789>) ``` -Atrium allows you to chain assertions or in other words -you only need to write the `expect(...)` part once and can make several single assertions for the same subject. -The expression which determines the subject of the assertion (`4 + 6` in the above example) is evaluated only once. +Atrium allows you to chain expectations or in other words +you only need to write the `expect(...)` part once and can state several single expectations for the same subject. +The expression which determines the subject of the expectations (`4 + 6` in the above example) is evaluated only once. In this sense we could have written it also as follows (which is only the same because `4 + 6` does not have side effects). @@ -303,16 +304,16 @@ expect(4 + 6).toBeGreaterThan(10) ``` -Correspondingly, the first `expect` statement (which does not hold) throws an `AssertionError`. +The first `expect` statement throws an `AssertionError` as it does not hold. In the above example, `toBeLessThan(5)` is already wrong and thus `toBeGreaterThan(10)` was not evaluated at all and correspondingly not reported. -If you want that both assertions are evaluated together, then use the assertion group syntax as follows: +If you want that both expectations are evaluated together, then use the expectation-group syntax as follows: ```kotlin -// assertion group with two assertions, both evaluated +// expectation-group with two expectations, both evaluated expect(4 + 6) { toBeLessThan(5) toBeGreaterThan(10) @@ -327,10 +328,11 @@ I expected subject: 10 (kotlin.Int <1234789>) ``` -An assertion group throws an `AssertionError` at the end of its block; hence reports that both assertions do not hold. -The reporting can be read as `I expected the subject of the assertion, which was 10, to be less than 5 and to be greater than 10` +An expectation-group throws an `AssertionError` at the end of its block (i.e. at the closing `}`); +hence reports that both expectations do not hold. +The reporting can be read as `I expected the subject of the expectation, which was 10, to be less than 5 and to be greater than 10` -You can use `and` as filling element between single assertions and assertion group blocks: +You can use `and` as filling element between single expectations and expectation-groups: @@ -350,7 +352,7 @@ expect(5) { ```kotlin expect { - // this block does something but eventually... + // this lambda does something but eventually... throw IllegalArgumentException("name is empty") }.toThrow() ``` @@ -370,16 +372,17 @@ I expected subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpe ``` -You can also pass a lambda to `expect` and then use `toThrow` to make the assertion that +You can also pass a lambda to `expect` and then use `toThrow` to state the expectation that invoking the lambda throws a certain exception (`IllegalStateException` in the example above). As with all narrowing functions, there are two overloads: -- the first is parameterless and turns only the subject into the expected type; +- the first expects an `assertionCreator`-lambda in which you can define sub-expectations. + An `assertionCreator`-lambda has always the semantic of an [expectation-group](#define-single-expectations-or-an-expectation-group). + It has also the benefit, that Atrium can show those sub-expectations in error reporting, + even if a failure happens before, giving some additional context to a failure. +- the second overload expects all the parameters except the `assertionCreator`-lambda and turns the subject into the expected type; failing to do so cannot include additional information in error reporting though. -- the second expects an `assertionCreator`-lambda in which you can define sub-assertions. - An `assertionCreator`-lambda has always the semantic of an [assertion group block](#define-single-assertions-or-assertion-groups). - It has also the benefit, that Atrium can provide those sub-assertions in error reporting, - showing some additional context in case of a failure. + The following example uses the first overload @@ -388,7 +391,9 @@ The following example uses the first overload ```kotlin expect { throw IllegalArgumentException() -}.toThrow().message.toStartWith("firstName") +}.toThrow { + message { toStartWith("firstName") } +} ``` ↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L71)[Output](#ex-toThrow2) @@ -397,33 +402,32 @@ I expected subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpe ◆ ▶ thrown exception when called: java.lang.IllegalArgumentException ◾ ▶ message: null ◾ to be an instance of type: String (kotlin.String) -- Class: java.lang.String + » to start with: "firstName" <1234789> ``` -And this one uses the second overload; notice the difference in reporting. +And this one uses the second overload; notice the difference in reporting, +this one does not include what sub-expectations would have been made if the narrowing succeeded ```kotlin expect { throw IllegalArgumentException() -}.toThrow { - message { toStartWith("firstName") } -} +}.toThrow().message.toStartWith("firstName") ``` -↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L77)[Output](#ex-toThrow3) +↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L79)[Output](#ex-toThrow3) ```text I expected subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpec$1$9$1 <1234789>) ◆ ▶ thrown exception when called: java.lang.IllegalArgumentException ◾ ▶ message: null ◾ to be an instance of type: String (kotlin.String) -- Class: java.lang.String - » to start with: "firstName" <1234789> ``` As side notice, `message` is a shortcut for `feature(Throwable::message).notToEqualNull`, -which creates a feature assertion (see next section) about `Throwable::message`. +which creates a feature extractor (see next section) about `Throwable::message`. There is also the counterpart of `toThrow` named `notToThrow`: @@ -458,16 +462,17 @@ Notice that stacks are filtered so that you only see what is of interest. You can [use your own](#use-own-components) [AtriumErrorAdjuster](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.reporting/-atrium-error-adjuster/index.html) to adjust the filtering. -Stack frames of Atrium and of test runners (Spek, Kotlintest and JUnit for JVM, mocha and jasmine for JS) are excluded per default. +Stack frames of Atrium and of test runners (Spek, Kotest, 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. -## Feature Assertions -Many times you are only interested in certain features of the subject and want to make assertions about them. + +## Feature Extractors +Many times you are only interested in certain features of the subject and want to state expectations about them. -There are different use cases for feature assertions. +There are different use cases for feature extractors. We will start of with properties and method calls and go on with more complicated scenarios. ### Property and Methods @@ -488,7 +493,7 @@ val myPerson = Person("Robert", "Stoll", false) ``` -The simplest way of defining assertions for a property of an instance or for the return value of a method call is by +The simplest way of defining expectations for a property of an instance or for the return value of a method call is by using the extension method `its`. @@ -508,40 +513,39 @@ I expected subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) ``` -In the above example we created two assertions, one for the property `isStudent` of `myPerson` +In the above example we created two expectations, one for the property `isStudent` of `myPerson` and a second one for the return value of calling `fullName()` on `myPerson`. -A feature assertion is indicated as follows in reporting: +A feature extractor is indicated as follows in reporting: It starts with a `▶` followed by the feature's description and its actual value. So the above output can be read as -> I expected the subject of the assertion, which was actually the Person(...), +> I expected the subject of the expectation, which was actually Person(...), > respectively its property which was defined in FeatureExtractorSpec.kt on line 43, > which was actually `false`, to equal `true`. -The second feature is not shown in reporting as the first already failed, and we have chosen to use [single assertions](#define-single-assertions-or-assertion-groups) +The second feature is not shown in reporting as the first expectation about the property `isStudent` already failed, +and we have chosen to use [single expectations](#define-single-expectations-or-an-expectation-group) which have fail-fast semantic. -Feature assertions follow the common pattern of having two overloads: -- the first expects only the extractor-lambda. - This overload narrows the subject to the feature, +Feature extractors follow the common pattern of having two overloads: +- the first expects an `assertionCreator`-lambda, in which you can define sub-expectations for the feature. + An `assertionCreator`-lambda has always the semantic of an [expectation-group](#define-single-expectations-or-an-expectation-group) + or in other words, not-fail fast. It has also the benefit, that Atrium can provide those sub-expectations in error reporting. + Moreover, the subject stays the same so that subsequent calls are still about the same subject +- the second overload expects all the parameters except the `assertionCreator`-lambda and changes the subject to the feature, meaning a subsequent call in the fluent chain is about the feature and not the previous subject. -- the second expects an `assertionCreator`-lambda in addition, in which you can define sub-assertions for the feature. - An `assertionCreator`-lambda has always the semantic of an [assertion group block](#define-single-assertions-or-assertion-groups) or in other words, not-fail fast. - It has also the benefit, that Atrium can provide those sub-assertions in error reporting, - Moreover, the subject stays the same so that subsequent calls are still about the same subject. - ```kotlin - expect(myPerson) { // forms an assertion group block + expect(myPerson) { // forms an expectation-group - its({ firstName }) { // forms an assertion group block + its({ firstName }) { // forms an expectation-group toStartWith("Pe") // fails toEndWith("er") // is evaluated nonetheless } // fails as a whole - // still evaluated, as it is in outer assertion group block + // still evaluated, as it is in outer expectation-group its { lastName }.toEqual("Dummy") } ``` @@ -584,8 +588,8 @@ I expected subject: Person(firstName=Robert, lastName=Stoll, isStudent=false) The report reads much nicer now: -> I expected the subject of the assertion, -> which was actually the Person(...), respectively its property `isStudent`, +> I expected the subject of the expectation, +> which was actually Person(...), respectively its property `isStudent`, > which was actually `false`, to equal `true` The drawback of `feature` compared to `its` is its syntax. Certainly, one has to get used to it first. Another is that @@ -595,22 +599,24 @@ you might run into [Ambiguity Problems](#ambiguity-problems) due to Kotlin bugs. Creating a `MetaFeature` is done via the function `f` by passing in a [bounded reference](https://kotlinlang.org/docs/reference/reflection.html#bound-function-and-property-references-since-11) of the corresponding property or method (including arguments if required). -`it` within the `MetaFeature`-provider-lambda refers to the subject of the assertion (`myPerson` in the above example). +`it` within the `MetaFeature`-provider-lambda refers to the subject of the expectation (`myPerson` in the above example). -Also `feature` follows the common pattern of having two overloads where the second expects an `assertionCreator`-lambda. +Also `feature` follows the common pattern of having two overloads where the first expects an `assertionCreator`-lambda and +the second has the same parameters except the `assertionCreator`-lambda and changes the subject to the feature, +meaning a subsequent call in the fluent chain is about the feature and not the previous subject. Following the second example rewritten from `its` to `feature`: ```kotlin -expect(myPerson) { // forms an assertion group block +expect(myPerson) { // forms an expectation-group - feature({ f(it::firstName) }) { // forms an assertion group block + feature({ f(it::firstName) }) { // forms an expectation-group toStartWith("Pe") // fails toEndWith("er") // is evaluated nonetheless } // fails as a whole - // still evaluated, as it is in outer assertion group block + // still evaluated, as it is in outer expectation-group feature { f(it::lastName) }.toEqual("Dummy") } ``` @@ -633,23 +639,23 @@ Please [open a feature request](https://github.com/robstoll/atrium/issues/new?te 💬 <- _this icon signifies answers/input for advanced users, you might want to skip them if you are new to Atrium._
-💬 Wrap each property into an assertion function? +💬 Provide a feature extractor for each property? -You might be asking yourself whether it is better to [write an own assertion function](#write-own-assertion-functions) or use `feature`. +You might be asking yourself whether it is better to [write an own feature extractor](#write-own-expectation-functions) or use `feature`. The only drawback of using an existing property is that a few more keystrokes are required compared to -[writing an own assertion function](#write-own-assertion-functions) once and then reuse it (as we did with `message`). -Yet, we do not recommend writing an own assertion function for every single property. +[writing an own feature extractor](#write-own-expectation-functions) once and then reuse it (as we did with `message`). +Yet, we do not recommend writing an own feature extractor for every single property. We think it makes sense to add one if you use it a lot and (preferably) it is a stable API. -Why not always? Because one quickly forgets to rename the assertion function +Why not always? Because one quickly forgets to rename the feature extractor if the property as such is renamed (e.g., as part of an IDE refactoring). -As you can see, you would need to keep the property name and the name of the assertion function in sync to be meaningful +As you can see, you would need to keep the property name and the name of the feature extractor in sync to be meaningful (otherwise one gets quickly confused or has to remember two names for the same thing). -Writing assertion functions for methods is a different story though, especially due to [overload bugs in Kotlin](https://github.com/robstoll/atrium/wiki/Kotlin-Bugs-and-missing-features). +Writing feature extractors for method calls is a different story though, especially due to [overload bugs in Kotlin](https://github.com/robstoll/atrium/wiki/Kotlin-Bugs-and-missing-features). Also, code completion is not yet as good as it should be when it comes to methods. Last but not least, in case it is not always safe to call a method (e.g. `List.get` => IndexOutOfBound) then it makes -sense to wrap it into an assertion function and use `_logic.extractFeature` instead. +sense to wrap it into an own feature extractor and use `_logic.extractFeature`.
@@ -680,16 +686,16 @@ Please [open a feature request](https://github.com/robstoll/atrium/issues/new?te in case you miss a shortcut.
-💬 Write own feature assertion functions with additional checks. +💬 Write own feature extractors with additional checks. -Atrium provides a feature extractor which allows making feature assertions in a safe way in case the extraction is only valid for certain subjects. +Atrium provides a feature extractor which allows to extract 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/main/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultListAssertions.kt#L13)
### Arbitrary Features A feature does not necessarily have to be directly related to the subject as properties or method calls do. -Either use `its` the overload of `feature` which expects a feature description in form of a `String` as first argument. +Either use `its` or the overload of `feature` which expects a feature description in form of a `String` as first argument. Following an example using `feature`. @@ -715,23 +721,21 @@ I expected subject: Family(members=[FamilyMember(name=Robert)]) (readme.e Also, this version of `feature` provides two different kind of overloads: -- the first expects a feature description and a feature-provider-lambda - This overload narrows the subject to the feature, +- the first expects a feature description, a feature-provider-lambda and an `assertionCreator`-lambda, in which you can define sub-expectations for the feature. + An `assertionCreator`-lambda has always the semantic of an [expectation-group](#define-single-expectations-or-an-expectation-group) or in other words, not-fail fast. + It has also the benefit, that Atrium can provide those sub-expectations in error reporting, + Moreover, the subject stays the same so that subsequent calls are still about the same subject. +- the second overload expects all the parameters except the `assertionCreator`-lambda and changes the subject to the feature, meaning a subsequent call in the fluent chain is about the feature and not the previous subject. -- the second expects an `assertionCreator`-lambda in addition, in which you can define sub-assertions for the feature. - An `assertionCreator`-lambda has always the semantic of an [assertion group block](#define-single-assertions-or-assertion-groups) or in other words, not-fail fast. - It has also the benefit, that Atrium can provide those sub-assertions in error reporting, - Moreover, the subject stays the same so that subsequent calls are still about the same subject. - -As you can see, Atrium provides a generic way to postulate assertions about features. -Yet, if you use such feature assertion often or it gets more complicated, -then it might be worth to [write an own assertion function](#write-own-assertion-functions) where we recommend to +As you can see, Atrium provides a generic way to postulate expectations about features. +Yet, if you extract the same feature over and over again or it gets more complicated, +then it might be worth to [write an own expectation function](#write-own-expectation-functions) where we recommend to use `feature` over `its`. -### Within Assertion Functions +### Within Expectation Functions / Feature Extractors -In case you write an own assertion function, then we discourage two things: +In case you write an own expectation function, then we discourage two things: - using `its` because the reporting reads less nice and it is also less efficient than `feature` - using `feature` with a `MetaFeature`-provider-lambda (as shown in [Property and Methods](#property-and-methods)) @@ -741,7 +745,7 @@ This has the benefit, that we can always show the feature name, also in case a p transformation failed. Following an example: - + ```kotlin fun > Expect.firstToBeDoneWrong(expected: F) = @@ -755,8 +759,8 @@ expect(listOf(1 to "a", 2 to "b")).get(10) { firstToBe(1) } ``` -↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L118)[Output](#ex-within-assertion-functions) - +↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt#L118)[Output](#ex-within-expectation-functions) + ```text I expected subject: [(1, a), (2, b)] (java.util.Arrays.ArrayList <1234789>) ◆ ▶ get(10): ❗❗ index out of bounds @@ -765,7 +769,7 @@ I expected subject: [(1, a), (2, b)] (java.util.Arrays.ArrayList <1234789 » ▶ first: ◾ to equal: 1 (kotlin.Int <1234789>) ``` - + Also, this version of `feature` provides two kind of overloads, one without and one with `assertionCreator`-lambda. (see for instance [Arbitrary Features](#arbitrary-features) for more information). @@ -828,9 +832,9 @@ expect(a) .startsWith(...) ``` -## Type Assertions +## Type Expectations - + ```kotlin interface SuperType @@ -839,65 +843,65 @@ data class SubType1(val number: Int) : SuperType data class SubType2(val word: String, val flag: Boolean) : SuperType val x: SuperType = SubType2("hello", flag = true) -expect(x).toBeAnInstanceOf() - .feature { f(it::number) } - .toEqual(2) +expect(x).toBeAnInstanceOf { + feature { f(it::word) }.toEqual("goodbye") + feature { f(it::flag) }.toEqual(false) +} ``` -↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L92)[Output](#ex-type-assertions-1) - +↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L92)[Output](#ex-type-expectations-1) + ```text I expected subject: SubType2(word=hello, flag=true) (readme.examples.SubType2 <1234789>) -◆ to be an instance of type: SubType1 (readme.examples.SubType1) +◆ ▶ word: "hello" <1234789> + ◾ to equal: "goodbye" <1234789> +◆ ▶ flag: true + ◾ to equal: false ``` - + -You can narrow a type with the `toBeA` function. -On one hand it checks that the subject of the current assertion (`x` in the above example) is actually the expected type +You can narrow the type of the subject with the `toBeAnInstanceOf` function. +On one hand it checks that the subject of the current expectation (`x` in the above example) is actually the expected type and on the other hand it turns the subject into this type. -This way you can make specific assertions which are only possible for the corresponding type +This way you can make specific expectations which are only possible for the corresponding type -- for instance, considering the above example, `number` is not available on `SuperType` but only on `SubType1`. - + ```kotlin -expect(x).toBeAnInstanceOf { - feature { f(it::word) }.toEqual("goodbye") - feature { f(it::flag) }.toEqual(false) -} +expect(x).toBeAnInstanceOf() + .feature { f(it::number) } + .toEqual(2) ``` -↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L98)[Output](#ex-type-assertions-2) - +↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L99)[Output](#ex-type-expectations-2) + ```text I expected subject: SubType2(word=hello, flag=true) (readme.examples.SubType2 <1234789>) -◆ ▶ word: "hello" <1234789> - ◾ to equal: "goodbye" <1234789> -◆ ▶ flag: true - ◾ to equal: false +◆ to be an instance of type: SubType1 (readme.examples.SubType1) ``` - + -There are two `toBeA` overloads: -- the first (shown in the first example) is parameterless and turns only the subject into the expected type; +There are two `toBeAnInstanceOf` overloads: +- the first (shown in the first example) expects an `assertionCreator`-lambda in which you can define sub-expectations. + An `assertionCreator`-lambda has always the semantic of an [expectation-group](#define-single-expectations-or-an-expectation-group) + -- as a recapitulation, expectations in an expectation-group are all evaluated and failures are reported at the end of the block. + It has also the benefit, that Atrium can provide those sub-expectations in error reporting, + showing some additional context in case of a failure. +- the second overload (shown in the second example) is parameterless and turns only the subject into the expected type; failing to do so cannot include additional information in error reporting though. -- the second (shown in the second example) expects an `assertionCreator`-lambda in which you can define sub-assertions. - An `assertionCreator`-lambda has always the semantic of an [assertion group block](#define-single-assertions-or-assertion-groups) - -- as a recapitulation, assertions in an assertion group block are all evaluated and failures are reported at the end of the block. - It has also the benefit, that Atrium can provide those sub-assertions in error reporting, - showing some additional context in case of a failure. ## Nullable Types -Let us look at the case where the subject of the assertion has a [nullable type](https://kotlinlang.org/docs/reference/null-safety.html). +Let us look at the case where the subject of the expectation has a [nullable type](https://kotlinlang.org/docs/reference/null-safety.html). ```kotlin -val slogan1: String? = "postulating assertions made easy" +val slogan1: String? = "postulating expectations made easy" expect(slogan1).toEqual(null) ``` ↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L106)[Output](#ex-nullable-1) ```text -I expected subject: "postulating assertions made easy" <1234789> +I expected subject: "postulating expectations made easy" <1234789> ◆ to equal: null ``` @@ -906,20 +910,20 @@ I expected subject: "postulating assertions made easy" <1234789> ```kotlin val slogan2: String? = null -expect(slogan2).toEqual("postulating assertions made easy") +expect(slogan2).toEqual("postulating expectations made easy") ``` ↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt#L110)[Output](#ex-nullable-2) ```text I expected subject: null -◆ to equal: "postulating assertions made easy" <1234789> +◆ to equal: "postulating expectations made easy" <1234789> ``` On one hand, you can use `toEqual` and pass the same type -- `String?` in the above example, so in other words either `null` as in the first example or a `String` as in the second example. On the other hand, you can use `notToEqualNull` to turn the subject into its non-null version. -This is a shortcut for `toBeA` where `Xy` is the non-nullable type (see [Type Assertions](#type-assertions)). +This is a shortcut for `toBeAnInstanceOf` where `Xy` is the non-nullable type (see [Type Expectations](#type-expectations)). Following an example: @@ -939,7 +943,7 @@ I expected subject: null Since `notToEqualNull` delegates to `toBeAnInstanceOf`, it also provides two overloads: one without (example above) and one with `assertionCreator`-lambda (example below); see -[Type Assertions](#type-assertions) for more information on the difference of the overloads. +[Type Expectations](#type-expectations) for more information on the difference of the overloads. @@ -968,13 +972,13 @@ then you can skip now to the next section (otherwise click on the arrow to expan -## Collection Assertions +## Collection Expectations -Atrium provides assertion builders which allow to make sophisticated `toContain` assertions for `Iterable`. -Such a building process allows you to define very specific assertions, where the process is guided by a fluent builder pattern. +Atrium provides expectation builders which allow to state sophisticated `toContain` expectations about `Iterable`. +Such a building process allows you to define very specific expectations, where the process is guided by a fluent builder pattern. You can either use such an -[Assertion Builder](#sophisticated-assertion-builders) -to create a specific assertion or use one of the +[Expectation Builder](#sophisticated-expectation-builders) +to create a specific expectation or use one of the [Shortcut Functions](#shortcut-functions) in case you have kind of a common case. The following sub sections show both use cases by examples. @@ -995,15 +999,15 @@ I expected subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) ``` -The assertion function `toContain(2, 3)` is a shortcut for using a -[Sophisticated Assertion Builder](#sophisticated-assertion-builders) -- it actually calls `toContain.inAnyOrder.atLeast(1).values(2, 3)`. -This is reflected in the output, which tells us that we expected that the `number of such entries`, which is actually `0`, `is at least: 1`. +The expectation function `toContain(2, 3)` is a shortcut for using a +[Sophisticated Expectation Builder](#sophisticated-expectation-builders) -- it actually calls `toContain.inAnyOrder.atLeast(1).values(2, 3)`. +This is reflected in the output.
👓 and what about expected value 2? 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 default reporter reports only failing assertions. +The output does not show anything about the expected value `2` because the default reporter reports only failing expectations. Back to the shortcut functions.
@@ -1011,8 +1015,8 @@ Back to the shortcut functions. Next to expecting that certain values are contained in or rather returned by an `Iterable`, Atrium allows us to use an `assertionCreator`-lambda to identify an element -(an `assertionCreator`-lambda can also be thought of as matcher / predicate in this context). -An element is considered as identified, if it holds all specified assertions. +(an `assertionCreator`-lambda can also be thought of as a matcher / predicate in this context). +An element is considered as identified, if it holds all specified expectations the `assertionCreator` creates. Following an example: @@ -1038,7 +1042,7 @@ I expected subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) ``` -In the above example, neither of the two lambdas matched any elements and thus both are reported as failing (sub) assertions. +In the above example, neither of the two lambdas matched any elements and thus both are reported as failing (sub) expectations. Another `toContain` shortcut function which Atrium provides for `Iterable` is kind of the opposite of `inAnyOrder.atLeast(1)` and is named `toContainExactly`. @@ -1054,7 +1058,7 @@ This makes of course only sense if your `Iterable` contains nullable elements. Atrium provides also a `notToContain` shortcut function. Furthermore, it provides aliases for `toContain` and `notToContain` named `toHaveNextAndAny` and `toHaveNextAndNone`, which might be a better choice if you think in terms of: expect a predicate holds. -These two are completed with an `toHaveNextAndAll` assertion function. +These two are completed with an `toHaveNextAndAll` expectation function. Following each in action: @@ -1116,10 +1120,10 @@ I expected subject: [1, 2, 3, 4] (java.util.Arrays.ArrayList <1234789>) -### Sophisticated Assertion Builders +### Sophisticated Expectation Builders -Sophisticated assertion builders implement a fluent builder pattern. -To use the assertion builder for sophisticated `Iterable`-toContain-assertions, you can type `toContain` +Sophisticated expectation builders implement a fluent builder pattern. +To use the expectation builder for sophisticated `Iterable`-toContain-expectations, you can type `toContain` -- as you would when using the [Shortcut Functions](#shortcut-functions) `toContain` -- but type `.` as next step (so that you are using the property `toContain` instead of one of the shortcut functions). Currently, the builder provides two options, either `inAnyOrder` or `inOrder`. @@ -1152,8 +1156,8 @@ I expected subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) Since we have chosen the `only` option, Atrium shows us a summary1 where we see three things: - Whether a specified `assertionCreator`-lambda matched (signified by `✔` or `✘`) - the corresponding element or not (e.g. `✘ ▶ entry 1:` was `2` and we expected, it `is less than 2`) -- Whether the expected size was correct or not (`✘ ▶ size:` was `4`, we expected it, `to be: 2` -- see also [Property Assertions](#property-assertions)) + the corresponding element or not (e.g. `✘ ▶ entry 1:` was `2` and we expected, it `to be less than 2`) +- Whether the expected size was correct or not (`✘ ▶ size:` was `4`, we expected it, `to equal: 2` - and last but not least, mismatches or additional elements as further clue (`❗❗ additional elements detected`). 😍 We are pretty sure you are going to love this feature as well. @@ -1164,7 +1168,7 @@ Please star Atrium if you like using it. then only failing expectations are shown.
-💬 Show only failing expectations/elements earlier than 10 elements? +💬 Show only failing expectations/elements earlier than 10 expected elements? You can use the `report` option to specify when Atrium shall start to show only failing expectations. Following an example changing the limit to 3 elements by using `showOnlyFailingIfMoreExpectedElementsThan` : @@ -1287,13 +1291,13 @@ I expected subject: [1, 2, 2, 4] (java.util.Arrays.ArrayList <1234789>) -## Map Assertions +## Map Expectations -Map assertions are kind of very similar to [Collection Assertions](#collection-assertions), also regarding reporting. +Map expectations are kind of very similar to [Collection Expectations](#collection-expectations), also regarding reporting. That is the reason why we are not going into too much detail here because we assume you are already familiar with it. We provide again [Shortcut Functions](#shortcut-functions-1) for the most common scenarios -and more [Sophisticated Assertion Builder](#sophisticated-assertion-builders-1) for the other cases. +and more [Sophisticated Expectation Builder](#sophisticated-expectation-builders-1) for the other cases. ### Shortcut Functions @@ -1313,8 +1317,8 @@ I expected subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) ``` -Next to making assertions based on key-value `Pair`s one can also define sub assertions for the value of an entry with -the help of the parameter object `KeyValue`: +Next to postulate expectations based on key-value `Pair`s one can also define sub expectations for the value of +an entry with the help of the parameter object `KeyValue`: @@ -1361,7 +1365,7 @@ I expected subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) ``` -And the other overload which expects a `KeyValue` and allows defining sub asertions for the value: +And the other overload which expects a `KeyValue` and allows defining sub expectations for the value: @@ -1388,7 +1392,7 @@ I expected subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) ``` -### Sophisticated Assertion Builders +### Sophisticated Expectation Builders Most functionality for `Map.toContain` are provided as shortcut functions but there is a handy one in case you deal with ordered Maps: `.toContain.inOrder.only` @@ -1418,7 +1422,7 @@ I expected subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) ``` -And the other expecting `KeyValue`s which allow specifying sub assertions for the value +And the other expecting `KeyValue`s which allow specifying sub expectations for the value @@ -1447,7 +1451,7 @@ I expected subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) ### Others -In case you want to postulate an assertion about a value of one particular key, then you can use `getExisting`. +In case you want to postulate an expectation about a value of one particular key, then you can use `getExisting`. For instance: @@ -1474,7 +1478,7 @@ I expected subject: {bernstein=Person(firstName=Leonard, lastName=Bernstein, age ``` -In case you want to make an assertion only about the keys or values of the `Map` then you can use `keys` or `values`: +In case you hvae only expectations about the keys or values of the `Map` then you can use `keys` or `values`: @@ -1503,10 +1507,10 @@ I expected subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) Last but not least, you can use the non-reporting `asEntries()` function which -turns `Expect>` into an `Expect>` and thus allows that you can use all the assertion -functions and sophisticated builders shown in [Collection Assertions](#collection-assertions). +turns `Expect>` into an `Expect>` and thus allows that you can use all the expectation +functions and sophisticated builders shown in [Collection Expectations](#collection-expectations). -There should seldom be a need for it but in case you want to make also sub assertions for the key, +There should seldom be a need for it but in case you want to make also sub expectations for the key, then it will come in handy: @@ -1538,15 +1542,15 @@ I expected subject: {a=1, b=2} (java.util.LinkedHashMap <1234789>) ``` -`toEqualKeyValue` as well as `key` and `value` are assertion functions defined for `Map.Entry`. +`toEqualKeyValue` as well as `key` and `value` are expectation functions defined for `Map.Entry`. -There are more assertion functions, a full list can be found in +There are more expectation 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). -## Path Assertions +## Path Expectations -Atrium’s assertions for paths give detailed failure hints explaining what happened on the file system. -For example, `exists` will explain which entry was the first one missing: +Atrium’s expectation functions for paths give detailed failure hints explaining what happened on the file system. +For example, `toExist` will explain which entry was the first one missing: @@ -1605,7 +1609,7 @@ I expected subject: /tmp/atrium-path/directory/subfolder/file (sun.nio.fs ## Attaching a Reason -In case you want to add further information to an assertion, e.g. state the reason why you expect it to hold, you can +In case you want to add further information to an expectation, e.g. state the reason why you expect it to hold, you can use `because`: @@ -1629,14 +1633,15 @@ I expected subject: "filename?" <1234789>
-💬 Use because only to give reasons for non-obvious assertions +💬 Use because only to give reasons for non-obvious expectations -`because` can be a useful tool for explaining why there is a certain assertion. Sometimes it is not directly obvious why one -should expect something. In such cases, using `because` can make your code, and your error messages, easier to +`because` can be a useful tool for explaining why there is a certain expectation. +Sometimes it is not directly obvious why one should expect something. +In such cases, using `because` can make your code, and your error messages, easier to understand for other developers (including yourself in three months). -Having said that, you should not use `because` if you are missing a specific predefined assertion function. You can use -a [feature assertion](#feature-assertions), [write your own expectation function](#write-own-assertion-functions) +Having said that, you should not use `because` if you are missing a specific predefined expectation function. +You can use a [feature extractor](#feature-extractors), [write your own expectation function](#write-own-expectation-functions) or [propose an addition to Atrium](https://github.com/robstoll/atrium/issues/new?template=feature_request.md&title=Missing%20Expectation%20Function) in such cases. @@ -1648,13 +1653,13 @@ Just like code comments, `because` can be valuable, but should not be overused. Atrium is not intended for data driven testing in the narrowed sense in terms that it cannot produce multiple tests. This is the responsibility of your test runner. -However, Atrium let you define multiple assertions within one test and reports them all if you want. +However, Atrium let you define multiple expectations within one test and reports them all if you want. In this sense it can be used for data driven testing. This is especially helpful in case your test runner does not support data driven testing (or other mechanisms like hierarchical or dynamic tests). -As an example, Atrium can help you writing data driven tests in a common module of a multiplatform-project. +As an example, Atrium can help you to write data driven tests in a common module of a multiplatform-project. -The trick is to wrap your assertions into an [assertion group block](#define-single-assertions-or-assertion-groups) -and create [Feature Assertions](#feature-assertions). Following an example: +The trick is to wrap your expectations into an [expectation-group](#define-single-expectations-or-an-expectation-group), +use [Feature Extractors](#feature-extractors) and state expectations about those feautres. Following an example: @@ -1682,13 +1687,13 @@ I expected subject: "calling myFun with..." <1234789> ``` -Depending on the chosen [reporting style](#reporterbuilder) it will only show the failing cases (default behaviour). +Per default, only failing expectations are shown. This is also the reason why the call of `myFun(2)` is not listed (as the result is `c` as expected). Please [create a feature request](https://github.com/robstoll/atrium/issues/new?template=feature_request.md&title=[Feature]) -if you want to see a summary, meaning also successful assertions -- we happily add more functionality if it is of use for someone. +if you want to see a summary, meaning also successful expectations -- we happily add more functionality if it is of use for someone. -Following another example which involves an assertion creator lambda and not only a simple `toEqual` check. +Following another example which involves an `assertionCreator`-lambda and not only a simple `toEqual` check. We are going to reuse the `myFun` from above: @@ -1724,7 +1729,7 @@ involved in a `Pair` is not (yet) inferred correctly by Kotlin. There is one last function worth mentioning here which comes in handy in data-driven testing in case the subject has a [nullable type]((https://kotlinlang.org/docs/reference/null-safety.html).) -If you wish to make sub-assertions on the non-nullable type of the subject, then you can use +If you wish to make sub expectations on the non-nullable type of the subject, then you can use `toEqualNullIfNullGivenElse` which accepts an `assertionCreator`-lambda or `null`. It is short for `if (assertionCreatorOrNull == null) toEqual(null) else notToEqual(assertionCreatorOrNull)`. Following another fictional example which illustrates `toEqualNullIfNullGivenElse` (we are reusing `myFun` from above): @@ -1762,10 +1767,10 @@ I expected subject: "calling myNullableFun with ..." <1234789> ## Further Examples -Atrium supports further assertion builders (e.g, for `CharSequence`) -as well as assertion functions which have not been shown in the examples. +Atrium supports further expectation builders (e.g, for `CharSequence`) +as well as expectation functions which have not been shown in the examples. Have a look at [apis/differences.md](https://github.com/robstoll/atrium/tree/main/apis/differences.md) for a few more examples. -This site contains also a list of all APIs with links to their assertion function catalogs. +This site contains also a list of all APIs with links to their expectation function catalogs. You can also have a look at the [specifications](https://github.com/robstoll/atrium/tree/main/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs) @@ -1775,9 +1780,9 @@ for more examples. Have a look into the [samples](https://github.com/robstoll/atrium/tree/main/samples) folder, it currently contains sample projects for -- [jvm gradle](https://github.com/robstoll/atrium/tree/main/samples/jvm/) - - [maven](https://github.com/robstoll/atrium/tree/main/samples/maven/) - [js](https://github.com/robstoll/atrium/tree/main/samples/js/) +- [jvm gradle](https://github.com/robstoll/atrium/tree/main/samples/jvm/) +- [jvm maven](https://github.com/robstoll/atrium/tree/main/samples/maven/) - [multiplatform project](https://github.com/robstoll/atrium/tree/main/samples/multiplatform/) Are you using a different runner? A PR would be appreciated 😊. @@ -1786,9 +1791,9 @@ Are you using a different runner? A PR would be appreciated 😊. Following extensions are maintained outside of this repository. -- [atrium-gradle-testkit](https://github.com/jGleitz/atrium-gradle-testkit): Atrium assertions to test Gradle plugins with TestKit. +- [atrium-gradle-testkit](https://github.com/jGleitz/atrium-gradle-testkit): Atrium expectations to test Gradle plugins with TestKit. -# How is Atrium different from other Assertion Libraries +# How is Atrium different from other Expectation/Assertion Libraries The following subsections shall give you a quick overview how Atrium differ from other assertion libraries. @@ -1802,14 +1807,14 @@ The following subsections shall give you a quick overview how Atrium differ from ## Ready to Help Atrium is designed to help you whenever possible. -We think this is the biggest difference to other assertion libraries and a very handy one indeed. +We think this is the biggest difference to other expectation libraries and a very handy one indeed. ### 1. Fluent API with Code Documentation Atrium provides a fluent API where the design focus was put on the interoperability (of the API) with the code completion functionality of your IDE. Or in other words, you can always use code completion to get direct help from your IDE. -This experience is improved by providing up-to-date [code documentation](#kdoc) (in form of KDoc) for all assertion functions, -so that you get the extra help needed. +This experience is improved by providing up-to-date [code documentation](#kdoc) (in form of KDoc) +for all expectation functions, so that you get the extra help needed. 💩 <- _this icon signifies a bug in Kotlin which you might encounter as well. We try to provide a workaround whenever possible._ @@ -1825,7 +1830,7 @@ But in case, you can also browse the online documentation, e.g. [KDoc of toEqual ### 2. Additional Information in Failure Reporting Atrium adds extra information to error messages so that you get quickly a better idea of what went wrong. -For instance, for the following assertion (which fails): +For instance, for the following expectation (which fails): @@ -1834,7 +1839,7 @@ expect(listOf(1, 2, 3)).toContain.inOrder.only.values(1, 3) ``` -Atrium points out which `values` were found, makes an implicit assertion about the size and +Atrium points out which `values` were found, makes an implicit expectation about the size and also states which entries were additionally contained in the list: @@ -1863,8 +1868,8 @@ expect(9.99f).toEqualWithErrorTolerance(10.0f, 0.01f) ``` -The above assertion looks good at first sight but actually fails (at least on my machine). -And without some extra information in the output we would believe that there is actually a bug in the assertion library itself. +The above expectation looks good at first sight but actually fails (at least on @robstoll's machine). +And without some extra information in the output we would believe that there is actually a bug in the expectation library itself. But Atrium shows where it goes wrong and even gives a possible hint: @@ -1877,8 +1882,8 @@ I expected subject: 9.99 (kotlin.Float <1234789>) ``` -One last example. This time about making an assertion that a certain `Throwable` is thrown but the assertion fails -because it was the wrong one. +One last example. This time about formulating an expectation that a certain `Throwable` is thrown but +the expectation fails because it was the wrong one. Atrium comes with a very useful hint, it shows the actual exception: @@ -1919,14 +1924,14 @@ I expected subject: () -> kotlin.Nothing (readme.examples.MostExamplesSpe ### 3. Prevents you from Pitfalls -But not enough. There are certain pitfalls when it comes to using an assertion library and Atrium tries to prevent you from those. +But not enough. There are certain pitfalls when it comes to using an expectation library and Atrium tries to prevent you from those. -For instance, an overload of `toEqual` and of `notToEqual` for `BigDecimal` was introduced which are both deprecated and throw a `PleaseReplaceException`. +For instance, an overload of `toEqual` and of `notToEqual` for `BigDecimal` was introduced which are both deprecated and throw a `PleaseUseReplacementException`. The reason behind it? It is very likely that a user actually wants to compare that a certain `BigDecimal` is numerically (not) equal to another `BigDecimal` rather than including `BigDecimal.scale` in the comparison. Accordingly, the deprecation message of `toEqual` (`notToEqual` alike) explains the problem and suggests to either use `toEqualNumerically` or `toEqualIncludingScale`. -And if the user should decide to use `toEqualIncludingScale` and at some point an assertion fails only due to the comparison of `BigDecimal.scale` +And if the user should decide to use `toEqualIncludingScale` and at some point an expectation fails only due to the comparison of `BigDecimal.scale` then Atrium reminds us of the possible pitfall. For instance: @@ -1939,7 +1944,7 @@ expect(BigDecimal.TEN).toEqualIncludingScale(BigDecimal("10.0")) ```text I expected subject: 10 (java.math.BigDecimal <1234789>) ◆ is equal (including scale): 10.0 (java.math.BigDecimal <1234789>) - ℹ notice, if you used toEqualNumerically then the assertion would have hold. + ℹ notice, if you used toEqualNumerically then the expectation would have been met. ``` @@ -1991,7 +1996,7 @@ The last difference is not yet fully-blown implemented, but the design of Atrium Might well be that this topic is not really a concern of yours; unless... - you are using domain-driven-design and would like to adopt the ubiquitous language also to your test code. -- you want to document the results of your defined assertions (in different languages) +- you want to document the results of your defined expectations (in different languages) Atrium already supports APIs in two languages, and it is an easy task to translate an API to another language (hello DDD-people 👋 you are good to go). Moreover, it is already possible to generate the output in a different language than the used API (e.g. code in English but report in German). @@ -2002,17 +2007,17 @@ You can use it to document your user stories etc (almost) for free. In case you have clients who speak different languages then the HTML-Report together with the i18n feature will be especially helpful. We should not go on here, the HTML-Report feature is not yet implemented, but you can see what kind of road we plan to go down to. -# Write own Assertion Functions +# Write own Expectation Functions -Are you missing an assertion function for a specific type and the generic -[Feature Assertions](#feature-assertions) are not good enough? +Are you missing an expectation function for a specific type and the generic +[Feature Extractors](#feature-extractors) are not good enough? -The following subsections will show how you can write your own assertion functions. -A pull request of your new assertion function is very much appreciated. +The following subsections will show how you can write your own expectation functions. +A pull request of your new expectation function is very much appreciated. -## Boolean based Assertions +## Boolean based Expectation Functions -This is kind of the simplest way of defining assertion functions. Following an example: +This is kind of the simplest way of defining expectation functions. Following an example: @@ -2040,7 +2045,7 @@ I expected subject: 12 (kotlin.Int <1234789>) Let us see how we actually defined `toBeAMultipleOf`. -1. *Choose the extension point*: in our example we want to provide the assertion function for `Int`s. +1. *Choose the extension point*: in our example we want to provide the expectation function for `Int`s. Hence, we define `toBeAMultipleOf` as [extension function](https://kotlinlang.org/docs/reference/extensions.html) of `Expect`. 2. *Use the method `_logic.createAndAppend`* which creates and appends @@ -2055,14 +2060,14 @@ Let us see how we actually defined `toBeAMultipleOf`. - and the actual check as lambda where you typically use `it` which refers to the subject of the expectation. We used a `String` as description in the above example because we are not bothered with internationalization at this point -(have a look at [Internationalization](#internationalization-1) if you are). +(have a look at [Internationalization](#internationalization-1) if you do). In most cases you probably use the expected value itself as its representation -- so you pass it as second argument. And finally you specify the test as such in the lambda passed as third argument. -But not all assertion functions require a value which is somehow compared against the subject --- some make an assertion about a characteristic of the subject without comparing it against an expected value. -Consider the following assertion function: +But not all expectation functions require a value which is somehow compared against the subject +-- some state an expectation about a characteristic of the subject without comparing it against an expected value. +Consider the following expectation function: @@ -2074,8 +2079,8 @@ fun Expect.toBeEven() = ``` -We are using a [Text](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.reporting/-text/index.html) -here so that `"an even number"` is not treated as a `String` in reporting. +We are using a [Text](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.reporting/-text/index.html) as +representation so that `"an even number"` is not treated as a `String` in reporting. Its usage looks then as follows: @@ -2091,13 +2096,13 @@ I expected subject: 13 (kotlin.Int <1234789>) ``` -## Compose Assertion Functions +## Compose Expectation Functions So far, we core contributors ran quickly into the situation where we wanted to compose functions or reuse existing functions but with different arguments. We will show both use cases here, starting off by composing functions. -Say you want to build a `toBeBetween` assertion function for `java.util.Date`, you could write it as follows: +Say you want to build a `toBeBetween` expectation function for `java.util.Date`, you could write it as follows: @@ -2109,8 +2114,8 @@ fun Expect.toBeBetween(lowerBoundInclusive: T, upperBoundExclusive Pretty simple, isn't it? Notice though, that this function fails fast, which means, the upper bound is not evaluated -if the assertion about the lower bound already fails. -You need to use an [assertion group block](#define-single-assertions-or-assertion-groups) +if the expectation about the lower bound already fails. +You need to use an [expectation-group](#define-single-expectations-or-an-expectation-group) if you want that both are evaluated: @@ -2133,7 +2138,7 @@ Still simple enough. That is right, we used a type parameter `T: Date` and not `Expect` directly. You should always do this unless your type is final (not `open`) and does not have type parameters itself - but to have a simple rule, just do it. -This way the assertion function is also available for sub types. This is because `Expect` is [invariant](https://kotlinlang.org/docs/reference/generics.html#variance). +This way the expectation function is also available for sub types. This is because `Expect` is [invariant](https://kotlinlang.org/docs/reference/generics.html#variance). Following an example: ```kotlin interface A { val foo get() = 1 } @@ -2161,7 +2166,7 @@ data class Person( ``` -Say you want to make an assertion about the number of children a person has: +Say you want to postulate an expectation about the number of children a person has: @@ -2173,8 +2178,8 @@ fun Expect.toHaveNumberOfChildren(number: Int): Expect = Three things to notice here: -1. we make use of a [feature assertion with class reference](#within-assertion-functions). -2. We use the overload which expects an `assertionCreator`-lambda. This way subsequent assertions are still made on `Person` and not on `children`. +1. we make use of a [feature extractor with class reference](#within-expectation-functions--feature-extractors). +2. We use the overload which expects an `assertionCreator`-lambda. This way subsequent expectations are still made on `Person` and not on `children`. Its usage is then as follows: @@ -2194,7 +2199,7 @@ I expected subject: Person(firstName=Susanne, lastName=Whitley, age=43, children ``` -Another example: assert the person has children which are all adults (assuming 18 is the age of majority). +Another example: expect the person to have children which are all adults (assuming 18 is the age of majority). @@ -2209,7 +2214,7 @@ fun Expect.toHaveAdultChildren(): Expect = ``` -We once again use `feature` with an [assertion group block](#define-single-assertions-or-assertion-groups) +We once again use `feature` with an [expectation-group](#define-single-expectations-or-an-expectation-group) for the same reason as above. Note how `toHaveElementsAndAll` already checks that there is at least one element. I.e. it fails for a `Person` with 0 children, because such a person does not have adult children. @@ -2232,7 +2237,7 @@ I expected subject: Person(firstName=Susanne, lastName=Whitley, age=43, children ``` -If we keep adding assertion functions involving `children` it might be best to provide a shortcut property and function. +If we keep adding expectation functions involving `children` it might be best to provide a shortcut property and function. @@ -2245,14 +2250,14 @@ fun Expect.children(assertionCreator: Expect>.() -> U Notice, that we have used a class-reference and not a bounded-reference to refer to `children` which is best practice -(see [feature assertions within assertion functions](#within-assertion-functions)). +(see [feature extractor within expectation functions]( #within-expectation-functions--feature-extractors)). With this, we can write things like: ```kotlin expect(Person("Susanne", "Whitley", 43, listOf(Person("Petra", "Whitley", 12, listOf())))) - .children { // using the fun -> assertion group, ergo sub-assertions don't fail fast + .children { // using the fun -> expectation-group, ergo sub expectations don't fail fast toHaveElementsAndNone { feature { f(it::firstName) }.toStartWith("Ro") } @@ -2260,15 +2265,11 @@ expect(Person("Susanne", "Whitley", 43, listOf(Person("Petra", "Whitley", 12, li feature { f(it::lastName) }.toEqual("Whitley") } } // subject is still Person here - .apply { // only evaluated because the previous assertion group holds - children // using the val -> subsequent assertions are about children and fail fast - .toHaveSize(2) - .toHaveElementsAndAny { - feature { f(it::age) }.toBeGreaterThan(18) - } - } // subject is still Person here due to the `apply` - .children // using the val -> subsequent assertions are about children and fail fast - .toHaveSize(2) + .children // using the val -> subsequent expectations are about children and fail fast + .toHaveSize(2) + .toHaveElementsAndAny { + feature { f(it::age) }.toBeGreaterThan(18) + } ``` ↑ [Example](https://github.com/robstoll/atrium/tree/main/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L101)[Output](#ex-own-compose-5) @@ -2282,17 +2283,17 @@ I expected subject: Person(firstName=Susanne, lastName=Whitley, age=43, children
-Enough of feature assertions. Let's move on to an example where we want to reuse an existing function but with different -arguments. Say we have a function which returns a list of first name / last name `Pair`s. +Enough of expectation functions for features. Let's move on to an example where we want to reuse an existing function +but with different arguments. Say we have a function which returns a list of first name / last name `Pair`s. We want to assert that the pairs contain only the first name / last name pairs of certain `Person`s in any order. -[Collection Assertions](#collection-assertions) will help us with this. +[Collection Expectations](#collection-expectations) will help us with this. However, `toContain.inAnyOrder.values` expects `Pair`s. So we have to map from `Person` to `Pair` upfront. As we have a variable length argument list and want to pass it to a variable length argument list, this cannot be done with a simple `map` from Kotlin. And it gets worse if we want to use `toContain.inAnyOrder.entries` which expects at least one `assertionCreator`-lambda (`Expect.() -> Unit`) because Kotlin cannot infer the types automatically. -`mapArguments` to the rescue, you can write the assertion function as follows: +`mapArguments` to the rescue, you can write the expectation function as follows: @@ -2313,7 +2314,7 @@ As you can see we moved the mapping inside the function so that the consumer of expect(get...WhichReturnsPairs()).areNamesOf(fKafka, eBloch, kTucholsky) ``` -Another fictional example, say we want to assert that the pairs have the same initials as the given persons and in the given order. +Another fictional example, say we expect that the pairs have the same initials as the given persons and in the given order. Which means, this time we need to use `assertionCreator`-lambdas. This can be written as follows: @@ -2338,25 +2339,25 @@ it suffices to create an extension function for `ArgumentMapperBuilder`. ## Enhanced Reporting -[Composing assertion functions](#compose-assertion-functions) give already quite a bit of power to an assertion function writer. +[Composing expectation functions](#compose-expectation-functions) give already quite a bit of power to an expectation function writer. Yet, sometimes we would like to create functions which have a better error reporting than the one we get -when we compose assertion functions. +when we compose expectation functions. [`_logic`](https://github.com/robstoll/atrium/tree/main/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) +- all expectation functions on the logic level (what you have seen in [Compose expectation functions](#compose-expectation-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>.asList()` uses it, see [arrayAssertions](https://github.com/robstoll/atrium/tree/main/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/main/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/main/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/main/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>.asList()` uses it, see [arrayAssertions](https://github.com/robstoll/atrium/tree/main/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/arraySubjectChangers.kt#L20)) + - reported, using `reportBuilder`; meaning a subject transformation which is shown in reporting as it incorporates a transformation (e.g. `toBeAnInstanceOf` uses it, see [AnyAssertions](https://github.com/robstoll/atrium/tree/main/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultAnyAssertions.kt#L66)) +- `collect` which allows to collect expectations - especially helpful in composing expectations (see [mapAssertions](https://github.com/robstoll/atrium/tree/main/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultMapAssertions.kt#L49)) +- `extractFeature` for feature extraction where it is not always save to extract (see [`List.get`](https://github.com/robstoll/atrium/tree/main/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 +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) -which can be used to create very specific assertion functions. +which can be used to create very specific expectation functions. You can find an example in [floatingPointAssertions](https://github.com/robstoll/atrium/blob/main/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/impl/DefaultFloatingPointAssertions.kt#L72) which makes use of explanatory assertions as well as providing a failure hint. @@ -2365,9 +2366,9 @@ Unfortunately we do not have the time to cover all cases, so let us know if you -- either by opening an issue or via the [atrium Slack channel](https://kotlinlang.slack.com/messages/C887ZKGCQ) ([Invite yourself](https://slack.kotlinlang.org/)). -## Own Sophisticated Assertion Builders +## Own Sophisticated Expectation Builders -Do you want to write an own sophisticated assertion builder (or extend a current with more options) instead of an assertion function? +Do you want to write an own sophisticated expectation builder (or extend a current one with more options) instead of an expectation function? Great, we do not provide documentation yet (had only one question about it since 2017). We are willing to provide more documentation if you need it (please open an issue). @@ -2397,18 +2398,17 @@ In order to create an own expectation verb it is sufficient to: What are the benefits of creating an own expectation verb: - you can encapsulate the reporting style.
This is especially useful if you have multiple projects and want to have a consistent reporting style. - For instance, you could change from same-line to multi-line reporting or report not only failing but also successful assertions, change the output language etc. + For instance, you could change from same-line to multi-line reporting or report not only failing but also successful expectations, change the output language etc.
💬 where should I put the atriumVerbs.kt? We suggest you create an adapter project for Atrium where you specify the expectation verb. - And most likely you will accumulate them with assertion functions which are so common + And most likely you will accumulate them with expectation functions which are so common that they appear in multiple projects -- please share them with us (get in touch with us via issue or slack) if they are not of an internal nature 😉
-- you can define some default configurations like show only failing assertions for `toContain.inOrder.only` What are the drawbacks: @@ -2480,7 +2480,7 @@ We distinguish between two use cases. You might want to generate the [Report](#report) in a different language or/and you might want to use the [API in a different language](#api-in-a-different-language). ## Report -Following on the example in [Write own Assertion Functions](#write-own-assertion-functions) +Following on the example in [Write own Expectation Functions](#write-own-expectation-functions) we show here how you need to write the `toBeAMultipleOf` function, so that it supports i18n. This way the report could be generated in another language. @@ -2523,7 +2523,7 @@ 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). 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. +due to encoding problems and missing implementations on other platforms than JVM. Notice, Atrium does not yet support the generation of multiple reports in the same test run. This might become handy if you want to generate an HTML report in different languages. @@ -2533,7 +2533,7 @@ However, Atrium is designed to support this use case -- if you need this feature

-Let us rewrite the `toBeEven` assertion function from the section [Write own Assertion Functions](#write-own-assertion-functions) +Let us rewrite the `toBeEven` expectation function from the section [Write own Expectation Functions](#write-own-expectation-functions) as second example: @@ -2561,11 +2561,11 @@ but also that one can use the function itself in a different language. Or in other words, provide our API in a different language (the same applies if you want to provide another API style). We split up the function in two parts: API and logic --- whereas the logic creates the assertion and the API provides a function for the user (the API as such) and -merely appends the assertion created by the logic to the `Expect`. +-- whereas the logic creates the expectation and the API provides a function for the user (the API as such) and +merely appends the expectation 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 an extension method for [AssertionContainer](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.creating/-assertion-container/index.html) @@ -2579,10 +2579,10 @@ fun AssertionContainer.toBeAMultipleOf(base: Int): Assertion = In the above example we created a simple [DescriptiveAssertion](https://docs.atriumlib.org/latest#/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. +We pass in a description (`TO_BE_A_MULTIPLE_OF`), we use `base` as representation of the expectation +and define a lambda which implements a test to define whether the expectation holds or not. -In the API module we define the extension function and append the assertion to the current `Expect` +In the API module we define the extension function and append the expectation to the current `Expect` by using `logicAppend` and calling the extension function from the logic module within the corresponding lambda. @@ -2643,7 +2643,7 @@ 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/main/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L19) - turns a type into a nullable type. + turns a type into a nullable type and a return type of a KFunction into a nullable type. - [`nullableContainer`](https://github.com/robstoll/atrium/tree/main/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/main/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/utils/nullable.kt#L66) @@ -2660,7 +2660,7 @@ The code documentation is generated with dokka and is hosted on github-pages: # Known Limitations According to the [YAGNI](https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it) principle this -library does not yet offer a lot of out-of-the-box assertion functions. +library does not yet offer a lot of out-of-the-box expectation functions. More functions will follow but only if they are used somewhere by someone. So, let us know if you miss something by creating a [feature request](https://github.com/robstoll/atrium/issues/new?template=feature_request.md&title=[Feature]). @@ -2691,7 +2691,7 @@ Feel free vote for [first class support for Array and Sequence in api-fluent](ht 💬 why do I not see anything about the transformation in reporting? `asIterable` uses `_logic.changeSubject.unreported` internally which is intended for not showing up in reporting. -If you would like that the transformation is reflected in reporting then you can use a regular feature assertion +If you would like that the transformation is reflected in reporting then you can use a regular feature extractor as follows: @@ -2722,7 +2722,7 @@ The milestones give you an overview of the planned (breaking) changes You are invited to take part in the discussions related to design decisions, upcoming features and more. Bring in your own wishes and ideas into this process. -In case you are missing a particular assertion function in Atrium, then please open a +In case you are missing a particular expectation function in Atrium, then please open a [Feature Request](https://github.com/robstoll/atrium/issues/new?template=feature_request.md&title=[Feature]) in this repository. @@ -2738,7 +2738,7 @@ You are more than welcome to contribute as well: - [ask a question](https://kotlinlang.slack.com/messages/C887ZKGCQ) so that we better understand where Atrium needs to improve. - write a blog post about Atrium (e.g. about a feature you like) or a tutorial (let us know we happily link to your page) -- share your assertion functions with the rest of us by creating a pull request (no need for i18n support or the like, we can augment your pull request). +- share your expectation functions with the rest of us by creating a pull request (no need for i18n support or the like, we can augment your pull request). - have a look at the [help wanted issues](https://github.com/robstoll/atrium/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) if you would like to code (ping us on [Slack](https://kotlinlang.slack.com/messages/C887ZKGCQ) if there are not any). diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/deprecatedMapEntryAssertions.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/deprecatedMapEntryAssertions.kt index df211701d5..f16e879c78 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/deprecatedMapEntryAssertions.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/deprecatedMapEntryAssertions.kt @@ -7,9 +7,8 @@ import ch.tutteli.atrium.logic.* * Expects that the property [Map.Entry.key] of the subject of `this` expectation * is equal to the given [key] and the property [Map.Entry.value] is equal to the given [value]. * - * Kind of a shortcut for `and { key { toEqual(key) }; value { toEqual(value) } }` where `and` denotes an - * expectation group block. - * Yet, the actual behaviour depends on implementation - could also be fail fast for instance or augment reporting etc. + * Shortcut for `and { key { toEqual(key) }; value { toEqual(value) } }` where `and` denotes an + * expectation-group. * * @return an [Expect] for the subject of `this` expectation. * diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/featureExtractors.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/featureExtractors.kt index 2970331669..7cd8edb459 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/featureExtractors.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/featureExtractors.kt @@ -29,7 +29,7 @@ fun Expect.its(extractor: T.() -> R): FeatureExpect = /** * Extracts a feature out of the current subject of `this` expectation with the help of the given [extractor], * creates a new [Expect] for it, - * applies an assertion group based on the given [assertionCreator] for the feature and + * applies an expectation-group based on the given [assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * @return an [Expect] for the subject of `this` expectation. @@ -63,7 +63,7 @@ fun Expect.feature(property: KProperty1): FeatureExpect /** * Extracts the [property] out of the current subject of `this` expectation, * creates a new [Expect] for it, - * applies an assertion group based on the given [assertionCreator] for the feature and + * applies an expectation-group based on the given [assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * @return an [Expect] for the subject of `this` expectation. @@ -96,7 +96,7 @@ fun Expect.feature(f: KFunction1): FeatureExpect = /** * Extracts the value which is returned when calling [f] on the current subject of `this` expectation, * creates a new [Expect] for it, - * applies an assertion group based on the given [assertionCreator] for the feature and + * applies an expectation-group based on the given [assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * @return an [Expect] for the subject of `this` expectation. @@ -133,7 +133,7 @@ fun Expect.feature( * Extracts the value which is returned when calling [f] with argument [a1] * on the current subject of `this` expectation, * creates a new [Expect] for it, - * applies an assertion group based on the given [assertionCreator] for the feature and + * applies an expectation-group based on the given [assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * @return an [Expect] for the subject of `this` expectation. @@ -171,7 +171,7 @@ fun Expect.feature( * Extracts the value which is returned when calling [f] with argument [a1], [a2] * on the current subject of `this` expectation, * creates a new [Expect] for it, - * applies an assertion group based on the given [assertionCreator] for the feature and + * applies an expectation-group based on the given [assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * @return an [Expect] for the subject of `this` expectation. @@ -209,7 +209,7 @@ fun Expect.feature( * Extracts the value which is returned when calling [f] with argument [a1], [a2], [a3] * on the current subject of `this` expectation, * creates a new [Expect] for it, - * applies an assertion group based on the given [assertionCreator] for the feature and + * applies an expectation-group based on the given [assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * @return an [Expect] for the subject of `this` expectation. @@ -247,7 +247,7 @@ fun Expect.feature( * Extracts the value which is returned when calling [f] with argument [a1], [a2], [a3], [a4] * on the current subject of `this` expectation, * creates a new [Expect] for it, - * applies an assertion group based on the given [assertionCreator] for the feature and + * applies an expectation-group based on the given [assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * @return an [Expect] for the subject of `this` expectation. @@ -284,7 +284,7 @@ fun Expect.feature( * Extracts the value which is returned when calling [f] with argument [a1], [a2], [a3], [a4], [a5] * on the current subject of `this` expectation, * creates a new [Expect] for it, - * applies an assertion group based on the given [assertionCreator] for the feature and + * applies an expectation-group based on the given [assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * @return an [Expect] for the subject of `this` expectation. @@ -322,7 +322,7 @@ fun Expect.feature(description: String, provider: T.() -> R): FeatureE * Extracts a feature out of the current subject of `this` expectation * based on the given [provider] and using the given [description], * creates a new [Expect] for it, - * applies an assertion group based on the given [assertionCreator] for the feature and + * applies an expectation-group based on the given [assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * @param provider Extracts the feature where the subject of `this` expectation is available via @@ -364,7 +364,7 @@ fun Expect.feature(provider: MetaFeatureOption.(T) -> MetaFeature(1).toEqualNullIfNullGivenElse(null) } - expect(1).toEqualNullIfNullGivenElse { // subject inside this block is of type Int + expect(1).toEqualNullIfNullGivenElse { // subject inside this expectation-group is of type Int toBeLessThan(2) } // subject here is back to type Int? @@ -97,10 +97,10 @@ class AnyExpectationSamples { .notToEqualNull { // subject is now of type Int toBeGreaterThan(0) toBeLessThan(10) - } // subject remains type Int also after the block + } // subject remains type Int also after the expectation-group .toEqual(1) - fails { // because subject is null, but since we use a block... + fails { // because subject is null, but since we use an expectation-group... expect(null).notToEqualNull { toBeGreaterThan(2) // ...reporting mentions that subject was expected `to be greater than: 2` } @@ -115,7 +115,7 @@ class AnyExpectationSamples { } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `.notToEqualNull()` if this is all you expect expect(1).notToEqualNull { } } @@ -142,10 +142,10 @@ class AnyExpectationSamples { expect(n) .toBeAnInstanceOf { // subject is now of type Int toBeGreaterThanOrEqualTo(15) - } // subject remains type Int also after the block + } // subject remains type Int also after the expectation-group .toBeLessThan(20) - fails { // because wrong type expected (Long instead of String), but since we use a block... + fails { // because wrong type expected (Long instead of String), but since we use an expectation-group... expect("A").toBeAnInstanceOf { toEqual(43) // ...reporting mentions that subject was expected `to equal: 43` } @@ -160,7 +160,7 @@ class AnyExpectationSamples { } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `.toBeAnInstanceOf()` if this is all you expect expect(1).toBeAnInstanceOf { } } @@ -202,8 +202,8 @@ class AnyExpectationSamples { fails { expect(13).toBeAnInstanceOf().and { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block where all expectations inside + // are evaluated together; for more details see: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups // use `.and.` if you want fail fast behaviour diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ArraySubjectChangerSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ArraySubjectChangerSamples.kt index 9f14517478..f05a877b8d 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ArraySubjectChangerSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ArraySubjectChangerSamples.kt @@ -24,13 +24,13 @@ class ArraySubjectChangerSamples { @Test fun asList() { expect(arrayOf("A", "B")) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf("A", "B")) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(arrayOf("A", "B")) .asList { @@ -44,13 +44,13 @@ class ArraySubjectChangerSamples { @Test fun asListEOut() { expect>(arrayOf("A", "B")) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf("A", "B")) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect>(arrayOf("A", "B")) .asList { @@ -71,13 +71,13 @@ class ArraySubjectChangerSamples { @Test fun byteArrAsList() { expect(byteArrayOf(1, 2, 3)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf(1, 2, 3)) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(byteArrayOf(1, 2, 3)) .asList { @@ -98,13 +98,13 @@ class ArraySubjectChangerSamples { @Test fun charArrAsList() { expect(charArrayOf('A', 'B', 'C')) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf('A', 'B', 'C')) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(charArrayOf('A', 'B', 'C')) .asList { @@ -125,13 +125,13 @@ class ArraySubjectChangerSamples { @Test fun shortArrAsList() { expect(shortArrayOf(1, 2, 3)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf(1, 2, 3)) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(shortArrayOf(1, 2, 3)) .asList { @@ -152,13 +152,13 @@ class ArraySubjectChangerSamples { @Test fun intArrAsList() { expect(intArrayOf(1, 2, 3)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf(1, 2, 3)) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(intArrayOf(1, 2, 3)) .asList { @@ -179,13 +179,13 @@ class ArraySubjectChangerSamples { @Test fun longArrAsList() { expect(longArrayOf(1L, 2L, 3L)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf(1L, 2L, 3L)) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(longArrayOf(1L, 2L, 3L)) .asList { @@ -206,13 +206,13 @@ class ArraySubjectChangerSamples { @Test fun floatArrAsList() { expect(floatArrayOf(1f, 2f, 3f)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf(1f, 2f, 3f)) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(floatArrayOf(1f, 2f, 3f)) .asList { @@ -233,13 +233,13 @@ class ArraySubjectChangerSamples { @Test fun doubleArrAsList() { expect(doubleArrayOf(1.1, 2.2, 3.3)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf(1.1, 2.2, 3.3)) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(doubleArrayOf(1.1, 2.2, 3.3)) .asList { @@ -260,13 +260,13 @@ class ArraySubjectChangerSamples { @Test fun booleanArrAsList() { expect(booleanArrayOf(true, false)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf(true, false)) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(booleanArrayOf(true, true)) .asList { diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CollectionFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CollectionFeatureExtractorSamples.kt index 56667faadd..4b6c783d6b 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CollectionFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CollectionFeatureExtractorSamples.kt @@ -25,7 +25,7 @@ class CollectionFeatureExtractorSamples { @Test fun size() { expect(listOf(1, 2, 3)) - .size { // subject inside this block is of type Int (actually 3) + .size { // subject inside this expectation-group is of type Int (actually 3) toBeGreaterThan(1) } // subject here is back to type List .size { @@ -33,8 +33,8 @@ class CollectionFeatureExtractorSamples { } fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(listOf(1, 2, 3)) .size { diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/FeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/FeatureExtractorSamples.kt index 62b882cb68..45418ae2ea 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/FeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/FeatureExtractorSamples.kt @@ -35,7 +35,7 @@ class FeatureExtractorSamples { val person = Person(name = "John Smith", age = 25) expect(person) - .its({ age }) { // subject within this block is of type Int + .its({ age }) { // subject within this expectation-group is of type Int toBeGreaterThan(18) toBeLessThan(35) } // subject here is back to type Person @@ -43,8 +43,8 @@ class FeatureExtractorSamples { fails { expect(person) .its({ age }) { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toBeGreaterThan(40) // fails @@ -76,7 +76,7 @@ class FeatureExtractorSamples { val person = Person(name = "John Smith", age = 25) expect(person) - .feature(Person::name) { // subject within this block is of type String + .feature(Person::name) { // subject within this expectation-group is of type String toStartWith("John") toEndWith("Smith") } // subject here is back to type Person @@ -84,8 +84,8 @@ class FeatureExtractorSamples { fails { expect(person) .feature(Person::name) { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toStartWith("Kevin") // fails @@ -130,8 +130,8 @@ class FeatureExtractorSamples { fails { expect(person) .feature(::f) { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toStartWith("Kevin") // fails @@ -173,7 +173,7 @@ class FeatureExtractorSamples { .feature( ::f, "Dr." - ) {// subject within this block is of type String (actually the return value of calling `f` with the given argument) + ) {// subject within this expectation-group is of type String (actually the return value of calling `f` with the given argument) toStartWith("Dr. John") toEndWith("Smith") } // subject here is back type Person @@ -181,8 +181,8 @@ class FeatureExtractorSamples { fails { expect(person) .feature(::f, "Dr.") { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toStartWith("Kevin") // fails @@ -227,7 +227,7 @@ class FeatureExtractorSamples { ::f, "Dr.", "PMP" - ) { // subject within this block is of type String (actually the return value of calling `f` with the given two arguments) + ) { // subject within this expectation-group is of type String (actually the return value of calling `f` with the given two arguments) toStartWith("Dr. John") toEndWith("Smith, PMP") } // subject here is back type Person @@ -235,8 +235,8 @@ class FeatureExtractorSamples { fails { expect(person) .feature(::f, "Dr.", "PMP") { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toStartWith("Kevin") // fails @@ -286,7 +286,7 @@ class FeatureExtractorSamples { "Dr.", "PMP", "Native" - ) { // subject within this block is of type String (actually the return value of calling `f` with the given three arguments) + ) { // subject within this expectation-group is of type String (actually the return value of calling `f` with the given three arguments) toStartWith("Dr. John Smith") toContain("PMP") toEndWith("English level: Native") @@ -295,8 +295,8 @@ class FeatureExtractorSamples { fails { expect(person) .feature(::f, "Dr.", "PMP", "Native") { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toStartWith("Kevin") // fails @@ -349,7 +349,7 @@ class FeatureExtractorSamples { "PMP", "Native", "C1" - ) { // subject within this block is of type String (actually the return value of calling `f` with the given four arguments) + ) { // subject within this expectation-group is of type String (actually the return value of calling `f` with the given four arguments) toStartWith("Dr. John Smith") toContain("PMP") toContain("English level: Native") @@ -359,8 +359,8 @@ class FeatureExtractorSamples { fails { expect(person) .feature(::f, "Dr.", "PMP", "Native", "C1") { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toStartWith("Kevin") // fails @@ -416,7 +416,7 @@ class FeatureExtractorSamples { "Native", "C1", "B2" - ) { // subject within this block is of type String (actually the return value of calling `f` with the given five arguments) + ) { // subject within this expectation-group is of type String (actually the return value of calling `f` with the given five arguments) toStartWith("Dr. John Smith") toContain("PMP") toContain("English level: Native") @@ -427,8 +427,8 @@ class FeatureExtractorSamples { fails { expect(person) .feature(::f, "Dr.", "PMP", "Native", "C1", "B2") { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toStartWith("Kevin") // fails @@ -465,7 +465,7 @@ class FeatureExtractorSamples { val person = Person(name = "John Smith", age = 25) expect(person) - .feature("Actual age", Person::age) { // subject within this block is now of type Int (actually 25) + .feature("Actual age", Person::age) { // subject within this expectation-group is now of type Int (actually 25) toBeLessThan(30) toBeGreaterThan(20) } // subject here is back type Person @@ -479,8 +479,8 @@ class FeatureExtractorSamples { expect(person) .feature("Actual age", Person::age) { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toBeLessThan(20) // fails @@ -513,7 +513,7 @@ class FeatureExtractorSamples { val person = Person(name = "John Smith", age = 25) expect(person) - .feature({ f(it::age) }) { // `it` refers to `person`, subject within this block is of type Int (actually 25) + .feature({ f(it::age) }) { // `it` refers to `person`, subject within this expectation-group is of type Int (actually 25) toBeGreaterThan(20) toBeLessThan(30) } // subject here is back to Person @@ -521,8 +521,8 @@ class FeatureExtractorSamples { fails { expect(person) .feature({ f(it::age) }) { - // introduces an expectation group block - // all expectations are evaluated inside an expectation group block; for more details: + // introduces an expectation-group block + // all expectations are evaluated inside an expectation-group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups toBeGreaterThan(30) // fails diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/Fun0ExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/Fun0ExpectationSamples.kt index 6a701eab92..9a4f3c3d38 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/Fun0ExpectationSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/Fun0ExpectationSamples.kt @@ -22,11 +22,11 @@ class Fun0ExpectationSamples { @Test fun toThrow() { expect { throw IllegalStateException("abc") } - .toThrow { // subject inside this block is of type IllegalStateException + .toThrow { // subject inside this expectation-group is of type IllegalStateException messageToContain("abc") } // subject keeps type IllegalStateException also after the block - fails { // because wrong type expected (IndexOutOfBoundsException instead of IllegalStateException), but since we use a block... + fails { // because wrong type expected (IndexOutOfBoundsException instead of IllegalStateException), but since we use an expectation-group... expect { throw IllegalStateException("abc") } .toThrow { messageToContain("abc") // ... reporting mentions that subject's message was expected `to contain: "abc"` @@ -34,7 +34,7 @@ class Fun0ExpectationSamples { } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `.toThrow()` if this is all you expect expect { throw IllegalStateException("abc") } .toThrow {} @@ -60,14 +60,14 @@ class Fun0ExpectationSamples { toEqual("abc") } // subject keeps type String also after the block - fails { // because an exception was thrown, but since we use a block... + fails { // because an exception was thrown, but since we use an expectation-group... expect<() -> String> { throw IllegalStateException("abc") } .notToThrow { toStartWith("abc") // ... reporting mentions that subject's message was expected `to start with: "abc"` } } - fails { // because an exception was thrown, but since we use a block... + fails { // because an exception was thrown, but since we use an expectation-group... expect<() -> String> { throw IllegalStateException("abc") } .notToThrow { toStartWith("abc") // ... reporting mentions that subject's message was expected `to start with: "abc"` @@ -75,7 +75,7 @@ class Fun0ExpectationSamples { } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `.notToThrow()` if this is all you expect expect { "abc" }.notToThrow {} } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/IterableExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/IterableExpectationSamples.kt index 29f81c7b32..e5bd21c798 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/IterableExpectationSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/IterableExpectationSamples.kt @@ -18,7 +18,7 @@ class IterableExpectationSamples { .toContain .inAnyOrder // order specifier .atMost(2) - .entry { // assertion group about the entry + .entry { // expectation-group about the entry toBeGreaterThan(2) } } @@ -33,7 +33,7 @@ class IterableExpectationSamples { fails { expect(listOf(1, 8, 5)) .notToContain - .entry { // assertion group about the entry + .entry { // expectation-group about the entry toBeGreaterThan(6) } } @@ -61,7 +61,7 @@ class IterableExpectationSamples { @Test fun toContainAssertions() { expect(listOf(1, 2, 2, 4)) - .toContain( // multiple assertion group entries are evaluated independently + .toContain( // multiple expectation-group entries are evaluated independently { toBeLessThan(2) }, { toBeGreaterThan(3) } ) diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ListFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ListFeatureExtractorSamples.kt index 0f4b115b16..5566a05856 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ListFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ListFeatureExtractorSamples.kt @@ -37,18 +37,18 @@ class ListFeatureExtractorSamples { val list = listOf(1, 2, 3) expect(list) - .get(0) { // subject inside this block is of type Int (actually 1) + .get(0) { // subject inside this expectation-group is of type Int (actually 1) toBeGreaterThan(0) toBeLessThan(2) } // subject here is back to type List - .get(1) { // subject inside this block is of type Int (actually 2) + .get(1) { // subject inside this expectation-group is of type Int (actually 2) toBeGreaterThan(1) toBeLessThan(3) } fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(list).get(0) { toBeGreaterThan(2) // fails @@ -58,7 +58,7 @@ class ListFeatureExtractorSamples { } - fails { // because index 3 is out of bound, but since we use a block... + fails { // because index 3 is out of bound, but since we use an expectation-group... expect(list).get(3) { toBeLessThan(0) // ...reporting mentions that the element at index 3 was expected `to be less than: 0` } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapEntryFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapEntryFeatureExtractorSamples.kt index 900d12ee3a..8d8c741272 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapEntryFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapEntryFeatureExtractorSamples.kt @@ -27,12 +27,12 @@ class MapEntryFeatureExtractorSamples { fun key() { val entry = mapOf(1 to "a").entries.first() - expect(entry).key { // subject inside this block is of type Int (actually 1) + expect(entry).key { // subject inside this expectation-group is of type Int (actually 1) toEqual(1) } // subject here is back to type Map.Entry fails { - expect(entry).key { // subject inside this block is of type Int (actually 1) + expect(entry).key { // subject inside this expectation-group is of type Int (actually 1) toEqual(2) // fails toBeLessThan(0) // still evaluated even though `toEqual` already fails, // use `.key.` if you want a fail fast behaviour @@ -61,12 +61,12 @@ class MapEntryFeatureExtractorSamples { fun value() { val entry = mapOf(1 to "a").entries.first() - expect(entry).value { // subject inside this block is of type String (actually "a") + expect(entry).value { // subject inside this expectation-group is of type String (actually "a") toEqual("a") } // subject here is back to type Map.Entry fails { - expect(entry).value { // subject inside this block is of type String (actually "a") + expect(entry).value { // subject inside this expectation-group is of type String (actually "a") toEqual("b") // fails toStartWith("z") // still evaluated even though `toEqual` already fails, // use `.value.` if you want a fail fast behaviour diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapExpectationSamples.kt index 8acdf0b0d9..061749b571 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapExpectationSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapExpectationSamples.kt @@ -36,13 +36,13 @@ class MapExpectationSamples { @Test fun toContainKeyValue() { expect(mapOf(1 to "a")) - .toContain(KeyValue(1) { // subject inside this block is of type String (actually "a") + .toContain(KeyValue(1) { // subject inside this expectation-group is of type String (actually "a") toEqual("a") }) fails { expect(mapOf(1 to "a")) - .toContain(KeyValue(1) { // subject inside this block is of type String (actually "a") + .toContain(KeyValue(1) { // subject inside this expectation-group is of type String (actually "a") toEqual("b") // fails because "a" is not equal to "b" }) } @@ -51,13 +51,13 @@ class MapExpectationSamples { @Test fun toContainOnlyKeyValue() { expect(mapOf(1 to "a")) - .toContainOnly(KeyValue(1) { // subject inside this block is of type String (actually "a") + .toContainOnly(KeyValue(1) { // subject inside this expectation-group is of type String (actually "a") toEqual("a") }) fails { expect(mapOf(1 to "a", 2 to "b")) - .toContainOnly(KeyValue(1) { // subject inside this block is of type String (actually "a") + .toContainOnly(KeyValue(1) { // subject inside this expectation-group is of type String (actually "a") toEqual("a") }) // fails because the map contains key 2 with value "b" in addition } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapFeatureExtractorSamples.kt index ef89db25b0..0694723543 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapFeatureExtractorSamples.kt @@ -30,26 +30,26 @@ class MapFeatureExtractorSamples { @Test fun getExisting() { expect(mapOf(1 to "a")) - .getExisting(1) { // subject inside this block is of type String (actually "a") + .getExisting(1) { // subject inside this expectation-group is of type String (actually "a") toEqual("a") } // subject here is back to type Map fails { expect(mapOf(1 to "a")) - .getExisting(1) { // subject inside this block is of type String (actually "a") + .getExisting(1) { // subject inside this expectation-group is of type String (actually "a") toEqual("b") // fails because "a" is not equal to "b" - toStartWith("z") // still evaluated because we use an expectation group block + toStartWith("z") // still evaluated because we use an expectation-group block // use `.getExisting(key).` if you want a fail fast behaviour } } fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(mapOf(1 to "a")) .getExisting(2) { // fails because key 2 does not exist - toEqual("a") // still evaluated because we use an expectation group block + toEqual("a") // still evaluated because we use an expectation-group block // use `.getExisting(key).` if you want a fail fast behaviour } } @@ -73,18 +73,18 @@ class MapFeatureExtractorSamples { @Test fun keys() { expect(mapOf(1 to "a")) - .keys { // subject inside this block is of type Set (containing 1) + .keys { // subject inside this expectation-group is of type Set (containing 1) toEqual(setOf(1)) } // subject here is back to type Map fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(mapOf(1 to "a")) - .keys { // subject inside this block is of type Set (containing 1) + .keys { // subject inside this expectation-group is of type Set (containing 1) toEqual(setOf(2)) // fails because 1 is not equal to 2 - toHaveSize(3) // still evaluated because we use an expectation group block + toHaveSize(3) // still evaluated because we use an expectation-group block // use `.keys.` if you want a fail fast behaviour } } @@ -108,18 +108,18 @@ class MapFeatureExtractorSamples { @Test fun values() { expect(mapOf(1 to "a")) - .values { // subject inside this block is of type Collection (containing "a") + .values { // subject inside this expectation-group is of type Collection (containing "a") toEqual(setOf("a")) } fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(mapOf(1 to "a")) - .values { // subject inside this block is of type Collection (containing <"a">) + .values { // subject inside this expectation-group is of type Collection (containing <"a">) toEqual(setOf("b")) // fails because "a" is not equal to "b" - toContain("c") // still evaluated because we use an expectation group block + toContain("c") // still evaluated because we use an expectation-group block // use `.values.` if you want a fail fast behaviour } } @@ -144,16 +144,16 @@ class MapFeatureExtractorSamples { @Test fun size() { expect(mapOf(1 to "a", 2 to "b")) - .size { // subject inside this block is of type Int (actually 2) + .size { // subject inside this expectation-group is of type Int (actually 2) toEqual(2) } // subject here is back to type Map fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(mapOf(1 to "a", 2 to "b")) - .size { // subject inside this block is of type Int (containing 2) + .size { // subject inside this expectation-group is of type Int (containing 2) toEqual(5) // fails because 5 is not equal to 2 toBeLessThan(1) // fails because 2 is not less than 1 // use `.size.` if you want a fail fast behaviour diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapSubjectChangerSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapSubjectChangerSamples.kt index 390b0a436d..440822e430 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapSubjectChangerSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/MapSubjectChangerSamples.kt @@ -20,12 +20,12 @@ class MapSubjectChangerSamples { @Test fun asEntries() { - expect(mapOf(1 to "a")).asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + expect(mapOf(1 to "a")).asEntries { // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) toEqual(mapOf(1 to "a").entries) } // subject here is back to type Map fails { - expect(mapOf(1 to "a")).asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + expect(mapOf(1 to "a")).asEntries { // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) toEqual(mapOf(1 to "b").entries) // fails because <1,"a"> is not equal to <1,"b"> } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/PairFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/PairFeatureExtractorSamples.kt index f26e74eb50..b27da9654f 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/PairFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/PairFeatureExtractorSamples.kt @@ -29,7 +29,7 @@ class PairFeatureExtractorSamples { val pair = 1 to "one" expect(pair) - .first { // subject inside this block is of type Int (actually 1) + .first { // subject inside this expectation-group is of type Int (actually 1) toBeLessThan(2) } // subject here is back to type Pair .first { @@ -37,8 +37,8 @@ class PairFeatureExtractorSamples { } fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(pair) .first { @@ -72,7 +72,7 @@ class PairFeatureExtractorSamples { val pair = "one" to 1 expect(pair) - .second { // subject inside this block is of type Int (actually 1) + .second { // subject inside this expectation-group is of type Int (actually 1) toBeLessThan(2) } // subject here is back to type Pair .second { @@ -80,8 +80,8 @@ class PairFeatureExtractorSamples { } fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(pair) .second { diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/SequenceSubjectChangerSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/SequenceSubjectChangerSamples.kt index e5c3a27aed..4de1ca8e30 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/SequenceSubjectChangerSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/SequenceSubjectChangerSamples.kt @@ -26,7 +26,7 @@ class SequenceSubjectChangerSamples { @Test fun asIterable() { expect(sequenceOf(1, 2, 3)) - .asIterable { // subject within this block is of type Iterable + .asIterable { // subject within this expectation-group is of type Iterable toContain(1) toContain(2) toContain(3) @@ -34,7 +34,7 @@ class SequenceSubjectChangerSamples { fails { expect(sequenceOf(1, 2, 3)) - .asIterable { // subject within this block is of type Iterable + .asIterable { // subject within this expectation-group is of type Iterable toContain(4) } // subject here is back to type Sequence } @@ -50,7 +50,7 @@ class SequenceSubjectChangerSamples { @Test fun asList() { expect(sequenceOf(1, 2, 3)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List toEqual(listOf(1, 2, 3)) } // subject here is back to type Sequence } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ThrowableFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ThrowableFeatureExtractorSamples.kt index 219082bf21..026b300950 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ThrowableFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ThrowableFeatureExtractorSamples.kt @@ -32,12 +32,12 @@ class ThrowableFeatureExtractorSamples { @Test fun message() { - expect(RuntimeException("abc")).message { // subject inside this block is of type String (actually "abc") + expect(RuntimeException("abc")).message { // subject inside this expectation-group is of type String (actually "abc") toContain("a") } // subject here is back to type RuntimeException fails { - expect(RuntimeException("abc")).message { // subject inside this block is of type String (actually "abc") + expect(RuntimeException("abc")).message { // subject inside this expectation-group is of type String (actually "abc") toContain("d") // fails toStartWith("z") // still evaluated even though `toContain` already fails // use `.message.` if you want a fail fast behaviour @@ -66,14 +66,14 @@ class ThrowableFeatureExtractorSamples { messageToContain("b") } - fails { // because wrong type expected (IllegalStateException instead of IndexOutOfBoundsException), but since we use a block... + fails { // because wrong type expected (IllegalStateException instead of IndexOutOfBoundsException), but since we use an expectation-group... expect(IllegalStateException(IndexOutOfBoundsException("abc"))).cause { messageToContain("b") // ... reporting mentions that subject's message was expected `to contain: "b"` } } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `.cause<...>()` if this is all you expect expect(IllegalStateException(IndexOutOfBoundsException("abc"))).cause { } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/AnyAssertionSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/AnyAssertionSamples.kt index cc1a443bb3..636efe2055 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/AnyAssertionSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/AnyAssertionSamples.kt @@ -100,7 +100,7 @@ class AnyAssertionSamples { }.toBe(1) fails { - // because you forgot to define an assertion in the assertion group block + // because you forgot to define an expectation in the expectation-group // use `notToBeNull()` if this is all you want to assert expect(1).notToBeNull { } } @@ -176,9 +176,9 @@ class AnyAssertionSamples { fails { expect(13).isA().and { - // introduces an assertion group block - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // introduces an expectation-group + // all expectations are evaluated inside an expectation-group; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group // use `.and.` if you want fail fast behaviour isNoneOf(1, 2, 13) // fails diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/CollectionAssertionSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/CollectionAssertionSamples.kt index eaaf5eb9be..5d58518476 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/CollectionAssertionSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/CollectionAssertionSamples.kt @@ -56,7 +56,7 @@ class CollectionAssertionSamples { @Test fun size() { expect(listOf(1, 2, 3)) - .size { // subject inside this block is of type Int (actually 3) + .size { // subject inside this expectation-group is of type Int (actually 3) isGreaterThan(1) } // subject here is back to type List .size { @@ -64,8 +64,8 @@ class CollectionAssertionSamples { } fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(listOf(1, 2, 3)) .size { diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapAssertionSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapAssertionSamples.kt index f0d1c0cdef..5321eb9f61 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapAssertionSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapAssertionSamples.kt @@ -45,7 +45,7 @@ class MapAssertionSamples { fun containsKeyValue() { expect(mapOf(1 to "a")) .contains( - KeyValue(1) { // subject inside this block is of type String (actually "a") + KeyValue(1) { // subject inside this expectation-group is of type String (actually "a") toBe("a") } ) @@ -53,7 +53,7 @@ class MapAssertionSamples { fails { expect(mapOf(1 to "a")) .contains( - KeyValue(1) { // subject inside this block is of type String (actually "a") + KeyValue(1) { // subject inside this expectation-group is of type String (actually "a") toBe("b") // fails because "a" is not equal to "b" } ) @@ -64,7 +64,7 @@ class MapAssertionSamples { fun containsOnlyKeyValue() { expect(mapOf(1 to "a")) .containsOnly( - KeyValue(1) { // subject inside this block is of type String (actually "a") + KeyValue(1) { // subject inside this expectation-group is of type String (actually "a") toBe("a") } ) @@ -72,7 +72,7 @@ class MapAssertionSamples { fails { expect(mapOf(1 to "a", 1 to "b")) .containsOnly( - KeyValue(1) { // subject inside this block is of type String (actually "a") + KeyValue(1) { // subject inside this expectation-group is of type String (actually "a") toBe("a") // fails because the map also contains Pair<1,"b"> } ) @@ -138,13 +138,13 @@ class MapAssertionSamples { @Test fun getExisting() { expect(mapOf(1 to "a")) - .getExisting(1) { // subject inside this block is of type String (actually "a") + .getExisting(1) { // subject inside this expectation-group is of type String (actually "a") toBe("a") } fails { expect(mapOf(1 to "a")) - .getExisting(1) { // subject inside this block is of type String (actually "a") + .getExisting(1) { // subject inside this expectation-group is of type String (actually "a") toBe("b") // fails because "a" is not equal to "b" } } @@ -159,18 +159,18 @@ class MapAssertionSamples { @Test fun keysFeature() { - // subject inside this block is of type Int + // subject inside this expectation-group is of type Int expect(mapOf(1 to "a")) .keys //subject is of type Set (actually <1>) .toContain { - // subject inside this block is of type Int + // subject inside this expectation-group is of type Int toBe(1) } fails { expect(mapOf(1 to "a")) .keys //subject is of type Set (actually <1>) - .contains { // subject inside this block is of type Int + .contains { // subject inside this expectation-group is of type Int toBe(2) // fails because 1 is not equal to 2 } } @@ -179,13 +179,13 @@ class MapAssertionSamples { @Test fun keys() { expect(mapOf(1 to "a")) - .keys { // subject inside this block is of type Set (actually <1>) + .keys { // subject inside this expectation-group is of type Set (actually <1>) toBe(setOf(1)) } fails { expect(mapOf(1 to "a")) - .keys { // subject inside this block is of type Set (actually <1>) + .keys { // subject inside this expectation-group is of type Set (actually <1>) toBe(setOf(2)) // fails because <1> is not equal to <2> } } @@ -193,22 +193,22 @@ class MapAssertionSamples { @Test fun valuesFeature() { - // subject inside this block is of type String + // subject inside this expectation-group is of type String expect(mapOf(1 to "a")) .values //subject is of type Collection (actually <"a">) .toContain { - // subject inside this block is of type String + // subject inside this expectation-group is of type String toBe("a") } fails { - // subject inside this block is of type String + // subject inside this expectation-group is of type String expect( // fails because "a" is not equal to "b" mapOf(1 to "a") ) .values //subject is of type Collection (actually <"a">) .toContain { - // subject inside this block is of type String + // subject inside this expectation-group is of type String toBe("b") // fails because "a" is not equal to "b" } } @@ -217,13 +217,13 @@ class MapAssertionSamples { @Test fun values() { expect(mapOf(1 to "a")) - .values { // subject inside this block is of type Collection (actually <"a">) + .values { // subject inside this expectation-group is of type Collection (actually <"a">) toBe(setOf("a")) } fails { expect(mapOf(1 to "a")) - .values { // subject inside this block is of type Collection (actually <"a">) + .values { // subject inside this expectation-group is of type Collection (actually <"a">) toBe(setOf("b")) // fails because <"a"> is not equal to <"b"> } } @@ -231,22 +231,22 @@ class MapAssertionSamples { @Test fun asEntriesFeature() { - // subject inside this block is of type Map.Entry (actually <1,"a">) + // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) expect(mapOf(1 to "a")).asEntries() .toContain { - // subject inside this block is of type Map.Entry (actually <1,"a">) + // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) toBe(mapOf(1 to "a").entries.first()) } fails { - // subject inside this block is of type Map.Entry (actually <1,"a">) + // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) expect( mapOf( 1 to "a" ) // fails because <1,"a"> is not equal to <1,"b"> ).asEntries() .toContain { - // subject inside this block is of type Map.Entry (actually <1,"a">) + // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) toBe(mapOf(1 to "b").entries.first()) // fails because <1,"a"> is not equal to <1,"b"> } } @@ -254,12 +254,12 @@ class MapAssertionSamples { @Test fun asEntries() { - expect(mapOf(1 to "a")).asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + expect(mapOf(1 to "a")).asEntries { // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) toBe(mapOf(1 to "a").entries) } fails { - expect(mapOf(1 to "a")).asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + expect(mapOf(1 to "a")).asEntries { // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) toBe(mapOf(1 to "b").entries) // fails because <1,"a"> is not equal to <1,"b"> } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapEntryAssertionSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapEntryAssertionSamples.kt index a13454512f..51c9dcb7f6 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapEntryAssertionSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/deprecated/MapEntryAssertionSamples.kt @@ -35,13 +35,13 @@ class MapEntryAssertionSamples { @Test fun key() { expect(mapOf(1 to "a").entries.first()) - .key { // subject inside this block is of type Int (actually 1) + .key { // subject inside this expectation-group is of type Int (actually 1) toBe(1) } fails { expect(mapOf(1 to "a").entries.first()) - .key { // subject inside this block is of type Int (actually 1) + .key { // subject inside this expectation-group is of type Int (actually 1) toBe(2) // fails because 1 is not equal to 2 } } @@ -63,13 +63,13 @@ class MapEntryAssertionSamples { @Test fun value() { expect(mapOf(1 to "a").entries.first()) - .value { // subject inside this block is of type String (actually "a") + .value { // subject inside this expectation-group is of type String (actually "a") toBe("a") } fails { expect(mapOf(1 to "a").entries.first()) - .value { // subject inside this block is of type String (actually "a") + .value { // subject inside this expectation-group is of type String (actually "a") toBe("b") // fails because "a" is not equal to "b" } } diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/FileSubjectChangerSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/FileSubjectChangerSamples.kt index e3e8826b8d..5a773fd60d 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/FileSubjectChangerSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/FileSubjectChangerSamples.kt @@ -31,14 +31,14 @@ class FileSubjectChangerSamples { fun asPath() { val file = tempDir.newFile("target").toFile() - expect(file).asPath { // subject within this block is of type Path + expect(file).asPath { // subject within this expectation-group is of type Path toBeARegularFile() toStartWith(tempDir) } // subject here is back to type File fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(file).asPath { toBeADirectory() // fails diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateFeatureExtractorSamples.kt index 9e8cce7c9d..7b53c7f056 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateFeatureExtractorSamples.kt @@ -27,14 +27,14 @@ class LocalDateFeatureExtractorSamples { @Test fun year() { expect(LocalDate.of(2021, Month.OCTOBER, 9)) - .year { // subject inside this block is of type Int (actually 2021) + .year { // subject inside this expectation-group is of type Int (actually 2021) toEqual(2021) toBeGreaterThan(2020) } // subject here is back to type LocalDate fails { expect(LocalDate.of(2021, Month.OCTOBER, 9)) - .year { // subject inside this block is of type Int (actually 2021) + .year { // subject inside this expectation-group is of type Int (actually 2021) notToEqual(1980) // fails toBeLessThan(2000) // not evaluated/reported because notToEqual already fails // use `.year.` if you want a fail fast behaviour @@ -60,14 +60,14 @@ class LocalDateFeatureExtractorSamples { @Test fun month() { expect(LocalDate.of(2021, Month.OCTOBER, 9)) - .month { // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + .month { // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) toBeGreaterThan(5) notToEqual(9) } // subject here is back to type LocalDate fails { expect(LocalDate.of(2021, Month.OCTOBER, 9)) - .month { // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + .month { // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) toBeLessThan(9) // fails toBeGreaterThan(11) // still evaluated even though `toBeLessThan(9)` already fails // use `.month.` if you want a fail fast behaviour @@ -93,14 +93,14 @@ class LocalDateFeatureExtractorSamples { @Test fun dayOfWeek() { expect(LocalDate.of(2021, Month.OCTOBER, 9)) - .dayOfWeek { // subject inside this block is of type DayOfWeek (actually SATURDAY) + .dayOfWeek { // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) toEqual(DayOfWeek.SATURDAY) notToEqual(DayOfWeek.SUNDAY) } // subject here is back to type LocalDate fails { expect(LocalDate.of(2021, Month.OCTOBER, 9)) - .dayOfWeek { // subject inside this block is of type DayOfWeek (actually SATURDAY) + .dayOfWeek { // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) toEqual(DayOfWeek.MONDAY) // fails notToEqual(DayOfWeek.SATURDAY) // still evaluated even though toEqual already fails // use `.dayOfWeek.` if you want a fail fast behaviour @@ -126,14 +126,14 @@ class LocalDateFeatureExtractorSamples { @Test fun day() { expect(LocalDate.of(2021, Month.OCTOBER, 9)) - .day { // subject inside this block is of type Int (actually 9) + .day { // subject inside this expectation-group is of type Int (actually 9) toEqual(9) toBeGreaterThan(5) } // subject here is back to type LocalDate fails { expect(LocalDate.of(2021, Month.OCTOBER, 9)) - .day { // subject inside this block is of type Int (actually 9) + .day { // subject inside this expectation-group is of type Int (actually 9) toEqual(5) // fails toBeLessThan(7) // still evaluated even though toEqual already fails // use `.day.` if you want a fail fast behaviour diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateTimeFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateTimeFeatureExtractorSamples.kt index 382e265096..83b82d2d36 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateTimeFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/LocalDateTimeFeatureExtractorSamples.kt @@ -27,14 +27,14 @@ class LocalDateTimeFeatureExtractorSamples { @Test fun year() { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) - .year { // subject inside this block is of type Int (actually 2021) + .year { // subject inside this expectation-group is of type Int (actually 2021) toEqual(2021) toBeGreaterThan(2020) } // subject here is back to type LocalDateTime fails { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) - .year { // subject inside this block is of type Int (actually 2021) + .year { // subject inside this expectation-group is of type Int (actually 2021) notToEqual(1980) // fails toBeLessThan(2000) // not evaluated/reported because notToEqual already fails // use `.year.` if you want a fail fast behaviour @@ -60,14 +60,14 @@ class LocalDateTimeFeatureExtractorSamples { @Test fun month() { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) - .month { // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + .month { // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) toBeGreaterThan(5) notToEqual(8) } // subject here is back to type LocalDateTime fails { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) - .month { // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + .month { // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) toBeLessThan(9) // fails toBeGreaterThan(11) // still evaluated even though toBeLessThan already fails // use `.month.` if you want a fail fast behaviour @@ -95,14 +95,14 @@ class LocalDateTimeFeatureExtractorSamples { @Test fun dayOfWeek() { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) - .dayOfWeek { // subject inside this block is of type DayOfWeek (actually SATURDAY) + .dayOfWeek { // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) toEqual(DayOfWeek.SATURDAY) notToEqual(DayOfWeek.SUNDAY) } // subject here is back to type LocalDateTime fails { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) - .dayOfWeek { // subject inside this block is of type DayOfWeek (actually SATURDAY) + .dayOfWeek { // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) toEqual(DayOfWeek.MONDAY) // fails notToEqual(DayOfWeek.SATURDAY) // still evaluated even though toEqual already fails // use `.dayOfWeek.` if you want a fail fast behaviour @@ -128,14 +128,14 @@ class LocalDateTimeFeatureExtractorSamples { @Test fun day() { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) - .day { // subject inside this block is of type Int (actually 9) + .day { // subject inside this expectation-group is of type Int (actually 9) toEqual(9) toBeGreaterThan(5) } // subject here is back to type LocalDateTime fails { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) - .day { // subject inside this block is of type Int (actually 9) + .day { // subject inside this expectation-group is of type Int (actually 9) toEqual(5) // fails toBeLessThan(7) // still evaluated even though toEqual already fails // use `.day.` if you want a fail fast behaviour diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/OptionalExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/OptionalExpectationSamples.kt index 5e2e0fb324..44f9fee4bb 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/OptionalExpectationSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/OptionalExpectationSamples.kt @@ -45,7 +45,7 @@ class OptionalExpectationSamples { @Test fun toBePresent() { - expect(Optional.of(10)).toBePresent { // subject within this block is of type Int (actually 10) + expect(Optional.of(10)).toBePresent { // subject within this expectation-group is of type Int (actually 10) toBeGreaterThan(0) toBeLessThan(11) } @@ -58,7 +58,7 @@ class OptionalExpectationSamples { } } - fails { // because it was empty, but since we use a block... + fails { // because it was empty, but since we use an expectation-group... expect(Optional.empty()).toBePresent { toBeGreaterThan(12) // ...reporting mentions that subject was expected `to be greater than: 12` // use `.toBePresent.` if you want a fail fast behaviour diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/PathFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/PathFeatureExtractorSamples.kt index d2cdfe9422..a33e507f7e 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/PathFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/PathFeatureExtractorSamples.kt @@ -37,14 +37,14 @@ class PathFeatureExtractorSamples { val extension = "txt" val dir = tempDir.newDirectory("test.$extension") - expect(dir).extension { // subject inside this block is of type String (actually "txt") + expect(dir).extension { // subject inside this expectation-group is of type String (actually "txt") notToBeEmpty() toEqual(extension) notToEndWith("jpg") } // subject here is back to type Path fails { - expect(dir).extension { // subject inside this block is of type String (actually "txt") + expect(dir).extension { // subject inside this expectation-group is of type String (actually "txt") toEqual("txtt") // fails because it doesn't equal to "txtt" toEndWith("jpg") // fails because it doesn't end with "jpg" // use `.extension.` if you want fail fast behaviour @@ -73,14 +73,14 @@ class PathFeatureExtractorSamples { fun fileName() { val dir = tempDir.newDirectory("test_dir") - expect(dir).fileName { // subject inside this block is of type String (actually "test_dir") + expect(dir).fileName { // subject inside this expectation-group is of type String (actually "test_dir") toEndWith("dir") toStartWith("test") notToBeBlank() } // subject here is back to type Path fails { - expect(dir).fileName { // subject inside this block is of type String (actually "test_dir") + expect(dir).fileName { // subject inside this expectation-group is of type String (actually "test_dir") toEndWith("foo") // fails because it does not end with "foo" toStartWith("invalid") // still evaluated even though toEndWith already fails // use `.fileName.` if you want fail fast behaviour @@ -112,7 +112,7 @@ class PathFeatureExtractorSamples { } // subject here is back to type Path fails { - expect(dir).fileNameWithoutExtension { // subject inside this block is of type String (actually "test_dir") + expect(dir).fileNameWithoutExtension { // subject inside this expectation-group is of type String (actually "test_dir") toBeEmpty() // fails because string is not empty notToEqual("test_dir") // still evaluated even though toBeEmpty already fails // use `.fileNameWithoutExtension.` if you want a fail fast behaviour @@ -141,7 +141,7 @@ class PathFeatureExtractorSamples { val dir = tempDir.newDirectory("test_dir_1") val dir2 = tempDir.newDirectory("test_dir_2") - expect(dir).parent { // subject inside this block refers to path corresponding to `test_dir_1/..` + expect(dir).parent { // subject inside this expectation-group refers to path corresponding to `test_dir_1/..` toEqual(dir2.parent) toExist() } // subject here is back to `test_dir_1` @@ -178,7 +178,7 @@ class PathFeatureExtractorSamples { val dir = tempDir.newDirectory("test_dir") val fileInDir = dir.newFile("test_file.txt") - expect(dir).resolve("test_file.txt") { // subject inside this block refers to `test_dir/test_file.txt` + expect(dir).resolve("test_file.txt") { // subject inside this expectation-group refers to `test_dir/test_file.txt` toEqual(fileInDir) toExist() } // subject here is back to `test_dir` diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ZonedDateTimeFeatureExtractorSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ZonedDateTimeFeatureExtractorSamples.kt index 88be7c03e0..6ec3bc51af 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ZonedDateTimeFeatureExtractorSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/ZonedDateTimeFeatureExtractorSamples.kt @@ -29,14 +29,14 @@ class ZonedDateTimeFeatureExtractorSamples { val zonedDateTime = ZonedDateTime.of(LocalDateTime.of(2021, 10, 9, 11, 56), ZoneId.systemDefault()) expect(zonedDateTime) - .year { // subject inside this block is of type Int (actually 2021) + .year { // subject inside this expectation-group is of type Int (actually 2021) toEqual(2021) toBeGreaterThan(2020) } // subject here is back to type ZonedDateTime fails { expect(zonedDateTime) - .year { // subject inside this block is of type Int (actually 2021) + .year { // subject inside this expectation-group is of type Int (actually 2021) notToEqual(1980) // fails toBeLessThan(2000) // not evaluated/reported because notToEqual already fails // use `.year.` if you want a fail fast behaviour @@ -66,14 +66,14 @@ class ZonedDateTimeFeatureExtractorSamples { val zonedDateTime = ZonedDateTime.of(LocalDateTime.of(2021, 10, 9, 11, 56), ZoneId.systemDefault()) expect(zonedDateTime) - .month { // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + .month { // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) toBeGreaterThan(5) notToEqual(8) } // subject here is back to type ZonedDateTime fails { expect(zonedDateTime) - .month { // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + .month { // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) toBeLessThan(9) // fails toBeGreaterThan(11) // still evaluated even though toBeLessThan already fails // use `.month.` if you want a fail fast behaviour @@ -105,14 +105,14 @@ class ZonedDateTimeFeatureExtractorSamples { val zonedDateTime = ZonedDateTime.of(LocalDateTime.of(2021, 10, 9, 11, 56), ZoneId.systemDefault()) expect(zonedDateTime) - .dayOfWeek { // subject inside this block is of type DayOfWeek (actually SATURDAY) + .dayOfWeek { // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) toEqual(DayOfWeek.SATURDAY) notToEqual(DayOfWeek.SUNDAY) } // subject here is back to type ZonedDateTime fails { expect(zonedDateTime) - .dayOfWeek { // subject inside this block is of type DayOfWeek (actually SATURDAY) + .dayOfWeek { // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) toEqual(DayOfWeek.MONDAY) // fails notToEqual(DayOfWeek.SATURDAY) // still evaluated even though toEqual already fails // use `.dayOfWeek.` if you want a fail fast behaviour @@ -140,14 +140,14 @@ class ZonedDateTimeFeatureExtractorSamples { val zonedDateTime = ZonedDateTime.of(LocalDateTime.of(2021, 10, 9, 11, 56), ZoneId.systemDefault()) expect(zonedDateTime) - .day { // subject inside this block is of type Int (actually 9) + .day { // subject inside this expectation-group is of type Int (actually 9) toEqual(9) toBeGreaterThan(5) } // subject here is back to type ZonedDateTime fails { expect(zonedDateTime) - .day { // subject inside this block is of type Int (actually 9) + .day { // subject inside this expectation-group is of type Int (actually 9) toEqual(5) // fails toBeLessThan(7) // still evaluated even though toEqual already fails // use `.day.` if you want a fail fast behaviour diff --git a/apis/fluent-en_GB/extensions/kotlin_1_3/atrium-api-fluent-en_GB-kotlin_1_3-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/kotlin_1_3/samples/ResultExpectationSamples.kt b/apis/fluent-en_GB/extensions/kotlin_1_3/atrium-api-fluent-en_GB-kotlin_1_3-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/kotlin_1_3/samples/ResultExpectationSamples.kt index 02179f6494..b964ed4d7b 100644 --- a/apis/fluent-en_GB/extensions/kotlin_1_3/atrium-api-fluent-en_GB-kotlin_1_3-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/kotlin_1_3/samples/ResultExpectationSamples.kt +++ b/apis/fluent-en_GB/extensions/kotlin_1_3/atrium-api-fluent-en_GB-kotlin_1_3-common/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/kotlin_1_3/samples/ResultExpectationSamples.kt @@ -34,7 +34,7 @@ class ResultExpectationSamples { @Test fun toBeASuccess() { - expect(Result.success(10)).toBeASuccess { // subject within this block is of type Int (actually 10) + expect(Result.success(10)).toBeASuccess { // subject within this expectation-group is of type Int (actually 10) toEqual(10) toBeLessThan(15) } // subject here is back to type Result @@ -47,7 +47,7 @@ class ResultExpectationSamples { } } - fails { // because it was a Failure, but since we use a block... + fails { // because it was a Failure, but since we use an expectation-group... expect(Result.failure(ArithmeticException())).toBeASuccess { toBeGreaterThan(12) // ...reporting mentions that subject was expected `to be greater than: 12` // use `.toBeASuccess.` if you want a fail fast behaviour @@ -92,7 +92,7 @@ class ResultExpectationSamples { val errorMessage = "can not divide by zero" val failure = Result.failure(ArithmeticException(errorMessage)) - expect(failure).toBeAFailure { // subject within this block is of type ArithmeticException + expect(failure).toBeAFailure { // subject within this expectation-group is of type ArithmeticException messageToContain("parameter") } // subject here is back to type Result @@ -104,7 +104,7 @@ class ResultExpectationSamples { } } - fails { // because wrong Expectation type expected, but since we use a block... + fails { // because wrong Expectation type expected, but since we use an expectation-group... expect(failure).toBeAFailure { messageToContain("parameter") // ...reporting mentions that subject's message was expected `to contain: "parameter"`` // use `.toBeAFailure.` if you want a fail fast behaviour diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/anyExpectations.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/anyExpectations.kt index cc7a96a782..ca2f2d04e4 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/anyExpectations.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/anyExpectations.kt @@ -246,7 +246,7 @@ infix fun Expect.and(assertionCreator: Expect.() -> Unit): Expect = _logic.appendAsGroup(assertionCreator) /** - * Inline property referring actually to `this` and allows writing infix assertions within an assertion group block + * Inline property referring actually to `this` and allows writing infix assertions within an expectation-group * * For instance, instead of: * ``` @@ -270,7 +270,7 @@ infix fun Expect.and(assertionCreator: Expect.() -> Unit): Expect = inline val Expect.it: Expect get() : Expect = this /** - * Inline property referring actually to `this` and allows writing infix assertions within an assertion group block + * Inline property referring actually to `this` and allows writing infix assertions within an expectation-group * * For instance, instead of: * ``` diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/deprecatedMapEntryAssertions.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/deprecatedMapEntryAssertions.kt index 98993f996e..1172f8c277 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/deprecatedMapEntryAssertions.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/deprecatedMapEntryAssertions.kt @@ -10,7 +10,7 @@ import ch.tutteli.atrium.logic.value * Expects that the property [Map.Entry.key] of the subject of `this` expectation * is equal to the given [key] and the property [Map.Entry.value] is equal to the given [value]. * - * Kind of a shortcut for `and { key { it toEqual key }; value { it toEqual value } }` where `and` denotes an assertion group + * Kind of a shortcut for `and { key { it toEqual key }; value { it toEqual value } }` where `and` denotes an expectation-group * block. Yet, the actual behaviour depends on implementation - could also be fail fast for instance or augment * reporting etc. * diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/featureExtractors.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/featureExtractors.kt index 1e2085498b..1cfc6665e0 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/featureExtractors.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/infix/en_GB/featureExtractors.kt @@ -25,7 +25,7 @@ infix fun Expect.its(extractor: T.() -> R): FeatureExpect = /** * Extracts a feature out of the current subject of `this` expectation with the help of the given * [extractorWithCreator.extractor][ExtractorWithCreator.extractor], - * creates a new [Expect] for it, applies an assertion group based on the given + * creates a new [Expect] for it, applies an expectation-group based on the given * [extractorWithCreator.assertionCreator][ExtractorWithCreator.assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * @@ -65,7 +65,7 @@ infix fun Expect.feature(property: KProperty1): FeatureExpect * returns it so that subsequent calls are based on the feature. * * Use `feature of(...)` in case the method requires parameters or in case you want to define - * an assertion group block for it. + * an expectation-group for it. * * @return The newly created [Expect] for the return value of calling the method [f] * on the current subject of `this` expectation. @@ -106,7 +106,7 @@ infix fun Expect.feature(of: Feature): FeatureExpect = /** * Extracts a feature out of the current subject of `this` expectation using the given [FeatureWithCreator.extractor], * creates a new [Expect] for it, - * applies an assertion group based on the given [FeatureWithCreator.assertionCreator] for the feature and + * applies an expectation-group based on the given [FeatureWithCreator.assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * Use `of(K..., ...) { ... }` to create a [FeatureWithCreator] where the first argument is the extractor in @@ -156,7 +156,7 @@ infix fun Expect.feature(provider: MetaFeatureOption.(T) -> MetaFea * Extracts a feature out of the current subject of `this` expectation, * based on the given [MetaFeatureOptionWithCreator] * creates a new [Expect] for it, - * applies an assertion group based on the given [MetaFeatureOptionWithCreator.assertionCreator] for the feature and + * applies an expectation-group based on the given [MetaFeatureOptionWithCreator.assertionCreator] for the feature and * returns the initial [Expect] with the current subject. * * Note that you need to enable the new type inference of Kotlin (or use Kotlin 1.4 and above) in order that Kotlin diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/AnyExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/AnyExpectationSamples.kt index 4c403a411f..e83a9f4929 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/AnyExpectationSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/AnyExpectationSamples.kt @@ -64,7 +64,7 @@ class AnyExpectationSamples { fun toEqualNullIfNullGivenElse() { expect(null) toEqualNullIfNullGivenElse null - expect(1) toEqualNullIfNullGivenElse { // subject inside this block is of type Int (actually 1) + expect(1) toEqualNullIfNullGivenElse { // subject inside this expectation-group is of type Int (actually 1) it toBeLessThan 2 } // subject here is back to type Int? @@ -96,7 +96,7 @@ class AnyExpectationSamples { */ toEqual 1 - fails { // because subject is null, but since we use a block... + fails { // because subject is null, but since we use an expectation-group... expect(null) notToEqualNull { it toBeGreaterThan 2 // ...reporting mentions that subject was expected `to be greater than: 2` } @@ -109,7 +109,7 @@ class AnyExpectationSamples { } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `notToEqualNull o` if this is all you expect expect(1) notToEqualNull { } } @@ -135,7 +135,7 @@ class AnyExpectationSamples { } /* subject remains type Int also after the block */ toBeLessThan 20 - fails { // because wrong type expected (Long instead of String), but since we use a block... + fails { // because wrong type expected (Long instead of String), but since we use an expectation-group... expect("A").toBeAnInstanceOf { it toEqual 43 // ...reporting mentions that subject was expected `to equal: 43` } @@ -148,7 +148,7 @@ class AnyExpectationSamples { } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `.toBeAnInstanceOf()` if this is all you expect expect(1).toBeAnInstanceOf { } } @@ -172,7 +172,7 @@ class AnyExpectationSamples { fails { expect(13).toBeAnInstanceOf() and { - // introduces an expectation group block + // introduces an expectation-group block // all expectations are evaluated inside an expectations group block; for more details: // https://github.com/robstoll/atrium#define-single-expectations-or-expectation-groups diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ArraySubjectChangerSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ArraySubjectChangerSamples.kt index 4a4e29672f..0d94a0cf56 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ArraySubjectChangerSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ArraySubjectChangerSamples.kt @@ -15,13 +15,13 @@ class ArraySubjectChangerSamples { @Test fun asList() { expect(arrayOf("A", "B")) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf("A", "B") } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(arrayOf("A", "B")) .asList { it toContain "C" // fails @@ -34,13 +34,13 @@ class ArraySubjectChangerSamples { @Test fun asListEOut() { expect>(arrayOf("A", "B")) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf("A", "B") } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect>(arrayOf("A", "B")) .asList { it toContain "C" // fails @@ -59,13 +59,13 @@ class ArraySubjectChangerSamples { @Test fun byteArrAsList() { expect(byteArrayOf(1, 2, 3)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf(1, 2, 3) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(byteArrayOf(1, 2, 3)) .asList { it toContain 98 // fails @@ -84,13 +84,13 @@ class ArraySubjectChangerSamples { @Test fun charArrAsList() { expect(charArrayOf('A', 'B', 'C')) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf('A', 'B', 'C') } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(charArrayOf('A', 'B', 'C')) .asList { it toContain 'X' // fails @@ -109,13 +109,13 @@ class ArraySubjectChangerSamples { @Test fun shortArrAsList() { expect(shortArrayOf(1, 2, 3)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf(1, 2, 3) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(shortArrayOf(1, 2, 3)) .asList { it toContain 98 // fails @@ -134,13 +134,13 @@ class ArraySubjectChangerSamples { @Test fun intArrAsList() { expect(intArrayOf(1, 2, 3)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf(1, 2, 3) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(intArrayOf(1, 2, 3)) .asList { it toContain 98 // fails @@ -159,13 +159,13 @@ class ArraySubjectChangerSamples { @Test fun longArrAsList() { expect(longArrayOf(1L, 2L, 3L)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf(1L, 2L, 3L) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(longArrayOf(1L, 2L, 3L)) .asList { it toContain 98L // fails @@ -184,13 +184,13 @@ class ArraySubjectChangerSamples { @Test fun floatArrAsList() { expect(floatArrayOf(1f, 2f, 3f)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf(1f, 2f, 3f) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(floatArrayOf(1f, 2f, 3f)) .asList { it toContain 98f // fails @@ -209,13 +209,13 @@ class ArraySubjectChangerSamples { @Test fun doubleArrAsList() { expect(doubleArrayOf(1.1, 2.2, 3.3)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf(1.1, 2.2, 3.3) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(doubleArrayOf(1.1, 2.2, 3.3)) .asList { it toContain 98.1 // fails @@ -234,13 +234,13 @@ class ArraySubjectChangerSamples { @Test fun booleanArrAsList() { expect(booleanArrayOf(true, false)) - .asList { // subject within this block is of type List + .asList { // subject within this expectation-group is of type List it toEqual listOf(true, false) } // subject here is back to type Array fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(booleanArrayOf(true, true)) .asList { it toContain false // fails diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/CollectionFeatureExtractorSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/CollectionFeatureExtractorSamples.kt index 4bc28e5a18..0eded40e6d 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/CollectionFeatureExtractorSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/CollectionFeatureExtractorSamples.kt @@ -28,17 +28,17 @@ class CollectionFeatureExtractorSamples { @Test fun size() { expect(listOf(1, 2, 3)) - .size { // subject inside this block is of type Int (actually 3) + .size { // subject inside this expectation-group is of type Int (actually 3) it toBeGreaterThan 1 } // subject here is back to type List - .size { // subject inside this block is of type Int (actually 3) + .size { // subject inside this expectation-group is of type Int (actually 3) it toBeLessThan 4 } fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups - expect(listOf(1, 2, 3)) size { // subject inside this block is of type Int (actually 3) + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group + expect(listOf(1, 2, 3)) size { // subject inside this expectation-group is of type Int (actually 3) it toBeLessThan 1 // fails it toBeGreaterThan 4 // isLessThan 1 fails, but isGreaterThan 4 still evaluated // use `.size.` if you want a fail fast behaviour diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/Fun0ExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/Fun0ExpectationSamples.kt index 0655de179d..9f6f0efd69 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/Fun0ExpectationSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/Fun0ExpectationSamples.kt @@ -22,11 +22,11 @@ class Fun0ExpectationSamples { @Test fun toThrow() { expect { throw IllegalStateException("abc") } - .toThrow { // subject inside this block is of type IllegalStateException + .toThrow { // subject inside this expectation-group is of type IllegalStateException its messageToContain "abc" } // subject keeps type IllegalStateException also after the block - fails { // because wrong type expected (IndexOutOfBoundsException instead of IllegalStateException), but since we use a block... + fails { // because wrong type expected (IndexOutOfBoundsException instead of IllegalStateException), but since we use an expectation-group... expect { throw IllegalStateException("abc") } .toThrow { its messageToContain "abc" // ... reporting mentions that subject's message was expected `to contain: "abc"` @@ -34,7 +34,7 @@ class Fun0ExpectationSamples { } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `.toThrow()` if this is all you expect expect { throw IllegalStateException("abc") } .toThrow {} @@ -60,14 +60,14 @@ class Fun0ExpectationSamples { it toEqual "abc" } // subject keeps type String also after the block - fails { // because an exception was thrown, but since we use a block... + fails { // because an exception was thrown, but since we use an expectation-group... expect<() -> String> { throw IllegalStateException("abc") } .notToThrow { it toStartWith "abc" // ... reporting mentions that subject's message was expected `to start with: "abc"` } } - fails { // because an exception was thrown, but since we use a block... + fails { // because an exception was thrown, but since we use an expectation-group... expect<() -> String> { throw IllegalStateException("abc") } .notToThrow { it toStartWith "abc" // ... reporting mentions that subject's message was expected `to start with: "abc"` @@ -75,7 +75,7 @@ class Fun0ExpectationSamples { } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `.notToThrow()` if this is all you expect expect { "abc" }.notToThrow {} } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/IterableExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/IterableExpectationSamples.kt index 9643f241af..8a632b309e 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/IterableExpectationSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/IterableExpectationSamples.kt @@ -64,7 +64,7 @@ class IterableExpectationSamples { @Test fun toContainAssertions() { expect(listOf(1, 2, 2, 4)) toContain entries( - // multiple assertion group entries are evaluated independently + // multiple expectation-group entries are evaluated independently { toBeLessThan(2) }, { toBeGreaterThan(3) } ) diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ListFeatureExtractorSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ListFeatureExtractorSamples.kt index 26d95eb142..fd330dae9e 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ListFeatureExtractorSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ListFeatureExtractorSamples.kt @@ -45,19 +45,19 @@ class ListFeatureExtractorSamples { fun get() { val list = listOf(1, 2, 3) - expect(list) get index(0) { // subject inside this block is of type Int (actually 1) + expect(list) get index(0) { // subject inside this expectation-group is of type Int (actually 1) it toBeLessThan 2 it toBeGreaterThan 0 } - expect(list) get index(1) { // subject inside this block is of type Int (actually 2) + expect(list) get index(1) { // subject inside this expectation-group is of type Int (actually 2) it toBeLessThan 3 it toBeGreaterThan 1 } fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(list) get index(0) { it toBeGreaterThan 2 // fails diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapEntryFeatureExtractorSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapEntryFeatureExtractorSamples.kt index 31eb40f84a..97a1538411 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapEntryFeatureExtractorSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapEntryFeatureExtractorSamples.kt @@ -28,12 +28,12 @@ class MapEntryFeatureExtractorSamples { fun key() { val entry = mapOf(1 to "a").entries.first() - expect(entry).key { // subject inside this block is of type Int (actually 1) + expect(entry).key { // subject inside this expectation-group is of type Int (actually 1) this toEqual 1 } // subject here is back to type Map.Entry fails { // because 1 is not equal to 2 - expect(entry).key { // subject inside this block is of type Int (actually 1) + expect(entry).key { // subject inside this expectation-group is of type Int (actually 1) this toEqual 2 } } @@ -58,12 +58,12 @@ class MapEntryFeatureExtractorSamples { fun value() { val entry = mapOf(1 to "a").entries.first() - expect(entry) value { // subject inside this block is of type String (actually "a") + expect(entry) value { // subject inside this expectation-group is of type String (actually "a") this toEqual "a" } // subject here is back to type Map.Entry fails { // because "a" is not equal to "b" - expect(entry) value { // subject inside this block is of type String (actually "a") + expect(entry) value { // subject inside this expectation-group is of type String (actually "a") this toEqual "b" } } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapExpectationSamples.kt index a49d3454b2..01fe44ac0b 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapExpectationSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapExpectationSamples.kt @@ -53,12 +53,12 @@ class MapExpectationSamples { @Test fun toContainKeyValue() { - expect(mapOf(1 to "a")) toContain keyValue(1) { // subject inside this block is of type String (actually "a") + expect(mapOf(1 to "a")) toContain keyValue(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "a" } fails { - expect(mapOf(1 to "a")) toContain keyValue(1) { // subject inside this block is of type String (actually "a") + expect(mapOf(1 to "a")) toContain keyValue(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "b" // fails because "a" is not equal to "b" } } @@ -66,14 +66,14 @@ class MapExpectationSamples { @Test fun toContainOnlyKeyValue() { - expect(mapOf(1 to "a")) toContainOnly keyValue(1) { // subject inside this block is of type String (actually "a") + expect(mapOf(1 to "a")) toContainOnly keyValue(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "a" } fails { // fails because the map contains key 2 with value "b" in addition expect( mapOf(1 to "a", 2 to "b") - ) toContainOnly keyValue(1) { // subject inside this block is of type String (actually "a") + ) toContainOnly keyValue(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "a" } } @@ -82,14 +82,14 @@ class MapExpectationSamples { @Test fun toContainKeyValues() { expect(mapOf(1 to "a")) toContain keyValues( - keyValue(1) { // subject inside this block is of type String (actually "a") + keyValue(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "a" } ) fails { expect(mapOf(1 to "a")) toContain keyValues( - keyValue(1) { // subject inside this block is of type String (actually "a") + keyValue(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "b" } ) @@ -99,17 +99,17 @@ class MapExpectationSamples { @Test fun toContainOnlyKeyValues() { expect(mapOf(1 to "a", 2 to "b")) toContainOnly keyValues( - keyValue(1) { // subject inside this block is of type String (actually "a") + keyValue(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "a" }, - keyValue(2) { // subject inside this block is of type String (actually "b") + keyValue(2) { // subject inside this expectation-group is of type String (actually "b") this toEqual "b" } ) fails { expect(mapOf(1 to "a", 2 to "b")) toContainOnly keyValues( - keyValue(1) { // subject inside this block is of type String (actually "a") + keyValue(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "a" } ) diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapFeatureExtractorSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapFeatureExtractorSamples.kt index 072f446791..e78011ca69 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapFeatureExtractorSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapFeatureExtractorSamples.kt @@ -26,22 +26,22 @@ class MapFeatureExtractorSamples { @Test fun getExisting() { - expect(mapOf(1 to "a")) getExisting key(1) { // subject inside this block is of type String (actually "a") + expect(mapOf(1 to "a")) getExisting key(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "a" } fails { - expect(mapOf(1 to "a")) getExisting key(1) { // subject inside this block is of type String (actually "a") + expect(mapOf(1 to "a")) getExisting key(1) { // subject inside this expectation-group is of type String (actually "a") this toEqual "b" // fails because "a" is not equal to "b" } } fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(mapOf(1 to "a")) getExisting key(2) { // fails because key 2 does not exist - this toEqual "a" // still evaluated because we use an expectation group block + this toEqual "a" // still evaluated because we use an expectation-group block // use `.getExisting(key).` if you want a fail fast behaviour } } @@ -61,17 +61,17 @@ class MapFeatureExtractorSamples { @Test fun keys() { - expect(mapOf(1 to "a")) keys { // subject inside this block is of type Set (containing 1) + expect(mapOf(1 to "a")) keys { // subject inside this expectation-group is of type Set (containing 1) this toEqual setOf(1) } fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group - expect(mapOf(1 to "a")) keys { // subject inside this block is of type Set (containing 1) + expect(mapOf(1 to "a")) keys { // subject inside this expectation-group is of type Set (containing 1) this toEqual setOf(2) // fails because 1 is not equal to 2 - this toHaveSize 3 // still evaluated because we use an expectation group block + this toHaveSize 3 // still evaluated because we use an expectation-group block // use `.keys.` if you want a fail fast behaviour } } @@ -91,15 +91,15 @@ class MapFeatureExtractorSamples { @Test fun values() { - expect(mapOf(1 to "a")) values { // subject inside this block is of type Collection (containing "a") + expect(mapOf(1 to "a")) values { // subject inside this expectation-group is of type Collection (containing "a") this toEqual setOf("a") } fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group - expect(mapOf(1 to "a")) values { // subject inside this block is of type Collection (containing <"a">) + expect(mapOf(1 to "a")) values { // subject inside this expectation-group is of type Collection (containing <"a">) this toEqual setOf("b") // fails because "a" is not equal to "b" // use `.values.` if you want a fail fast behaviour } @@ -118,12 +118,12 @@ class MapFeatureExtractorSamples { @Test fun asEntries() { - expect(mapOf(1 to "a")) asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + expect(mapOf(1 to "a")) asEntries { // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) this toEqual mapOf(1 to "a").entries } fails { - expect(mapOf(1 to "a")) asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + expect(mapOf(1 to "a")) asEntries { // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) this toEqual mapOf(1 to "b").entries // fails because <1,"a"> is not equal to <1,"b"> } } @@ -143,16 +143,16 @@ class MapFeatureExtractorSamples { @Test fun size() { - expect(mapOf(1 to "a", 2 to "b")) size { // subject inside this block is of type Int (containing 2) + expect(mapOf(1 to "a", 2 to "b")) size { // subject inside this expectation-group is of type Int (containing 2) this toEqual 2 this toBeGreaterThan 1 } fails { - // all expectations are evaluated inside an expectation group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group block; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group - expect(mapOf(1 to "a")) size { // subject inside this block is of type Int (containing 1) + expect(mapOf(1 to "a")) size { // subject inside this expectation-group is of type Int (containing 1) this toEqual 2 // fails because 1 is not equal to 2 this toBeLessThan 0 // fails because 1 is not less than 0 // use `.size.` if you want a fail fast behaviour diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapSubjectChangerSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapSubjectChangerSamples.kt index c82cd07832..17040323a4 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapSubjectChangerSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/MapSubjectChangerSamples.kt @@ -18,12 +18,12 @@ class MapSubjectChangerSamples { @Test fun asEntries() { - expect(mapOf(1 to "a")) asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + expect(mapOf(1 to "a")) asEntries { // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) this toEqual mapOf(1 to "a").entries } fails { - expect(mapOf(1 to "a")) asEntries { // subject inside this block is of type Map.Entry (actually <1,"a">) + expect(mapOf(1 to "a")) asEntries { // subject inside this expectation-group is of type Map.Entry (actually <1,"a">) this toEqual mapOf(1 to "b").entries // fails because <1,"a"> is not equal to <1,"b"> } } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PairFeatureExtractorSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PairFeatureExtractorSamples.kt index 58e15f13e0..60941acedb 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PairFeatureExtractorSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PairFeatureExtractorSamples.kt @@ -28,18 +28,18 @@ class PairFeatureExtractorSamples { val pair = 1 to "one" expect(pair) - .first { // subject inside this block is of type Int (actually 1) + .first { // subject inside this expectation-group is of type Int (actually 1) it toBeLessThan 2 } // subject here is back to type Pair - .first { // subject inside this block is of type Int (actually 1) + .first { // subject inside this expectation-group is of type Int (actually 1) it toBeGreaterThan 0 } fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(pair) - .first { // subject inside this block is of type Int (actually 1) + .first { // subject inside this expectation-group is of type Int (actually 1) it toBeGreaterThan 2 //fails it toBeLessThan 0 // still evaluated even though `toBeGreaterThan` already fails // use ` first o` if you want a fail fast behaviour @@ -72,18 +72,18 @@ class PairFeatureExtractorSamples { val pair = "one" to 1 expect(pair) - .second { // subject inside this block is of type Int (actually 1) + .second { // subject inside this expectation-group is of type Int (actually 1) it toBeLessThan 2 } // subject here is back to type Pair - .second { // subject inside this block is of type Int (actually 1) + .second { // subject inside this expectation-group is of type Int (actually 1) it toBeGreaterThan 0 } fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group expect(pair) - .second { // subject inside this block is of type Int (actually 1) + .second { // subject inside this expectation-group is of type Int (actually 1) it toBeGreaterThan 2 // fails it toBeLessThan 0 // still evaluated even though `toBeGreaterThan` already fails, // use ` second o` if you want a fail fast behaviour diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ThrowableFeatureExtractorSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ThrowableFeatureExtractorSamples.kt index fc6cf80906..dac615c63f 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ThrowableFeatureExtractorSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ThrowableFeatureExtractorSamples.kt @@ -28,12 +28,12 @@ class ThrowableFeatureExtractorSamples { @Test fun message() { - expect(RuntimeException("abc")) message { // subject inside this block is of type String (actually "abc") + expect(RuntimeException("abc")) message { // subject inside this expectation-group is of type String (actually "abc") toContain("a") } fails { - expect(RuntimeException("abc")) message { // subject inside this block is of type String (actually "abc") + expect(RuntimeException("abc")) message { // subject inside this expectation-group is of type String (actually "abc") toContain("d") } } @@ -59,14 +59,14 @@ class ThrowableFeatureExtractorSamples { it messageToContain "b" } - fails { // because wrong type expected (IllegalStateException instead of IndexOutOfBoundsException), but since we use a block... + fails { // because wrong type expected (IllegalStateException instead of IndexOutOfBoundsException), but since we use an expectation-group... expect(IllegalStateException(IndexOutOfBoundsException("abc"))).cause { it messageToContain "b" // ... reporting mentions that subject's message was expected `to contain: "b"` } } fails { - // because you forgot to define an expectation in the expectation group block + // because you forgot to define an expectation in the expectation-group block // use `.cause<...>()` if this is all you expect expect(IllegalStateException(IndexOutOfBoundsException("abc"))).cause { } } diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/AnyAssertionSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/AnyAssertionSamples.kt index 8139b8d6b3..966464f8d5 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/AnyAssertionSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/AnyAssertionSamples.kt @@ -89,12 +89,12 @@ class AnyAssertionSamples { fun toBeNullIfNullGivenElse() { expect(null) toBeNullIfNullGivenElse null - expect(1) toBeNullIfNullGivenElse { // subject inside this block is of type Int (actually 1) + expect(1) toBeNullIfNullGivenElse { // subject inside this expectation-group is of type Int (actually 1) it isLessThan 2 } // subject here is back to type Int? fails { - expect(1) toBeNullIfNullGivenElse { // subject inside this block is of type Int (actually 1) + expect(1) toBeNullIfNullGivenElse { // subject inside this expectation-group is of type Int (actually 1) it isLessThan 0 } // subject here is back to type Int? } @@ -120,20 +120,20 @@ class AnyAssertionSamples { } toEqual 1 // subject here remains type Int fails { - // because you forgot to define an assertion in the assertion group block + // because you forgot to define an expectation in the expectation-group // use `notToBeNull()` if this is all you want to assert expect(1) notToBeNull { } } fails { // notToBeNull already fails, reporting mentions that subject was expected `to be: 2` - expect(null) notToBeNull { // subject inside this block is of type Int (actually 1) + expect(null) notToBeNull { // subject inside this expectation-group is of type Int (actually 1) it toEqual 2 } // subject here remains type Int } fails { - expect(1) notToBeNull { // subject inside this block is of type Int (actually 1) + expect(1) notToBeNull { // subject inside this expectation-group is of type Int (actually 1) it isLessThan 0 } // subject here remains type Int } @@ -190,8 +190,8 @@ class AnyAssertionSamples { fails { expect(13).toBeAnInstanceOf() and { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups + // all expectations are evaluated inside an expectation-group; for more details: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group it isNoneOf values(1, 2, 13) // fails it isLessThan 10 // still evaluated and included in the error report // use `.and.` if you want fail fast behaviour diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/CollectionAssertionSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/CollectionAssertionSamples.kt index d5cd84ea0c..48060018a6 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/CollectionAssertionSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-common/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/deprecated/CollectionAssertionSamples.kt @@ -56,17 +56,17 @@ class CollectionAssertionSamples { @Test fun size() { expect(listOf(1, 2, 3)) - .size { // subject inside this block is of type Int (actually 3) + .size { // subject inside this expectation-group is of type Int (actually 3) it isGreaterThan 1 } // subject here is back to type List - .size { // subject inside this block is of type Int (actually 3) + .size { // subject inside this expectation-group is of type Int (actually 3) it isLessThan 4 } fails { - // all assertions are evaluated inside an assertion group block; for more details: - // https://github.com/robstoll/atrium#define-single-assertions-or-assertion-groups - expect(listOf(1, 2, 3)) size { // subject inside this block is of type Int (actually 3) + // all expectations inside an expectation-group are evaluated together; for more details see: + // https://github.com/robstoll/atrium#define-single-expectations-or-an-expectation-group + expect(listOf(1, 2, 3)) size { // subject inside this expectation-group is of type Int (actually 3) it isLessThan 1 // fails it isGreaterThan 4 // isLessThan 1 fails, but isGreaterThan 4 still evaluated // use `.size.` if you want a fail fast behaviour diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/LocalDateExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/LocalDateExpectationSamples.kt index 7cb644ae88..fe8750614e 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/LocalDateExpectationSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/LocalDateExpectationSamples.kt @@ -28,7 +28,7 @@ class LocalDateExpectationSamples { @Test fun year() { expect(LocalDate.of(2021, Month.OCTOBER, 9)) year { - // subject inside this block is of type Int (actually 2021) + // subject inside this expectation-group is of type Int (actually 2021) it toEqual 2021 it toBeGreaterThan 2020 } // subject here is back to type LocalDate @@ -36,7 +36,7 @@ class LocalDateExpectationSamples { fails { expect(LocalDate.of(2021, Month.OCTOBER, 9)) year { - // subject inside this block is of type Int (actually 2021) + // subject inside this expectation-group is of type Int (actually 2021) it notToEqual 2021 it toBeGreaterThan 2022 it toBeLessThan 2020 @@ -63,14 +63,14 @@ class LocalDateExpectationSamples { @Test fun month() { expect(LocalDate.of(2021, Month.OCTOBER, 9)) month { - // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) it toEqual Month.OCTOBER.value it notToEqual Month.SEPTEMBER.value } // subject here is back to type LocalDate fails { expect(LocalDate.of(2021, Month.OCTOBER, 9)) month { - // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) it toBeLessThan 9 // fails it toBeGreaterThan 11 // still evaluated even though toBeLessThan already fails // use `.month` if you want a fail fast behaviour @@ -97,14 +97,14 @@ class LocalDateExpectationSamples { @Test fun dayOfWeek() { expect(LocalDate.of(2021, Month.OCTOBER, 9)) dayOfWeek { - // subject inside this block is of type DayOfWeek (actually SATURDAY) + // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) it toEqual DayOfWeek.SATURDAY it notToEqual DayOfWeek.SUNDAY } // subject here is back to type LocalDate fails { expect(LocalDate.of(2021, Month.OCTOBER, 9)) dayOfWeek { - // subject inside this block is of type DayOfWeek (actually SATURDAY) + // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) it toEqual DayOfWeek.MONDAY // fails it notToEqual DayOfWeek.SATURDAY // still evaluated even though toEqual already fails // use `.dayOfWeek.` if you want a fail fast behaviour @@ -131,14 +131,14 @@ class LocalDateExpectationSamples { @Test fun day() { expect(LocalDate.of(2021, Month.OCTOBER, 9)) day { - // subject inside this block is of type Int (actually 9) + // subject inside this expectation-group is of type Int (actually 9) it toEqual 9 it toBeGreaterThan 5 } // subject here is back to type LocalDate fails { expect(LocalDate.of(2021, Month.OCTOBER, 9)) day { - // subject inside this block is of type Int (actually 9) + // subject inside this expectation-group is of type Int (actually 9) it toEqual 5 // fails it toBeLessThan 7 // still evaluated even though toEqual already fails // use `.day` if you want a fail fast behaviour diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/LocalDateTimeExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/LocalDateTimeExpectationSamples.kt index 89ef81f8f2..1132c33ab5 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/LocalDateTimeExpectationSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/LocalDateTimeExpectationSamples.kt @@ -28,14 +28,14 @@ class LocalDateTimeExpectationSamples { @Test fun year() { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) year { - // subject inside this block is of type Int (actually 2021) + // subject inside this expectation-group is of type Int (actually 2021) it toEqual 2021 it toBeGreaterThan 2020 } // subject here is back to type LocalDateTime fails { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) year { - // subject inside this block is of type Int (actually 2021) + // subject inside this expectation-group is of type Int (actually 2021) it notToEqual 2021 // fails it toBeGreaterThan 2022 // not evaluated/reported because notToEqual already fails // use `.year.` if you want a fail fast behaviour @@ -62,14 +62,14 @@ class LocalDateTimeExpectationSamples { @Test fun month() { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) month { - // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) it toEqual Month.OCTOBER.value it notToEqual Month.SEPTEMBER.value } // subject here is back to type LocalDateTime fails { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) month { - // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) it toBeLessThan 9 // fails it toBeGreaterThan 11 // still evaluated even though toBeLessThan already fails // use `.month` if you want a fail fast behaviour @@ -96,14 +96,14 @@ class LocalDateTimeExpectationSamples { @Test fun dayOfWeek() { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) dayOfWeek { - // subject inside this block is of type DayOfWeek (actually SATURDAY) + // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) it toEqual DayOfWeek.SATURDAY it notToEqual DayOfWeek.SUNDAY } // subject here is back to type LocalDateTime fails { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) dayOfWeek { - // subject inside this block is of type DayOfWeek (actually SATURDAY) + // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) it toEqual DayOfWeek.MONDAY // fails it notToEqual DayOfWeek.SATURDAY // still evaluated even though toEqual already fails // use `.dayOfWeek.` if you want a fail fast behaviour @@ -130,14 +130,14 @@ class LocalDateTimeExpectationSamples { @Test fun day() { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) day { - // subject inside this block is of type Int (actually 9) + // subject inside this expectation-group is of type Int (actually 9) it toEqual 9 it toBeGreaterThan 5 } // subject here is back to type LocalDateTime fails { expect(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56)) day { - // subject inside this block is of type Int (actually 9) + // subject inside this expectation-group is of type Int (actually 9) it toEqual 5 // fails it toBeLessThan 7 // still evaluated even though toEqual already fails // use `.day` if you want a fail fast behaviour diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt index 53f26b4956..6905307bd6 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/PathExpectationSamples.kt @@ -379,14 +379,14 @@ class PathExpectationSamples { val dir = tempDir.newDirectory("test.$extension") - expect(dir) extension { // subject inside this block is of type String (actually "txt") + expect(dir) extension { // subject inside this expectation-group is of type String (actually "txt") it notToBe empty it toEqual extension it notToEndWith "jpg" } // subject here is back to type Path fails { - expect(dir) extension { // subject inside this block is of type String (actually "txt") + expect(dir) extension { // subject inside this expectation-group is of type String (actually "txt") it toEqual "txtt" // fails because it doesn't equal to "txtt" it toEndWith "jpg" // fails because it doesn't end with "jpg" // use `.extension` if you want fail fast behaviour @@ -414,14 +414,14 @@ class PathExpectationSamples { fun fileName() { val dir = tempDir.newDirectory("test_dir") - expect(dir) fileName { // subject inside this block is of type String (actually "test_dir") + expect(dir) fileName { // subject inside this expectation-group is of type String (actually "test_dir") it toEndWith "dir" it toStartWith "test" it notToBe blank } // subject here is back to type Path fails { - expect(dir) fileName { // subject inside this block is of type String (actually "test_dir") + expect(dir) fileName { // subject inside this expectation-group is of type String (actually "test_dir") it toEndWith "foo" // fails because it does not end with "foo" it toStartWith "invalid" // still evaluated even though toEndWith already fails // use `.fileName` if you want fail fast behaviour @@ -448,13 +448,13 @@ class PathExpectationSamples { fun fileNameWithoutExtension() { val dir = tempDir.newDirectory("test_dir") - expect(dir) fileNameWithoutExtension { // subject inside this block is of type String (actually "test_dir") + expect(dir) fileNameWithoutExtension { // subject inside this expectation-group is of type String (actually "test_dir") it notToBe empty it toEqual "test_dir" } fails { - expect(dir) fileNameWithoutExtension { // subject inside this block is of type String (actually "test_dir") + expect(dir) fileNameWithoutExtension { // subject inside this expectation-group is of type String (actually "test_dir") it toBe empty // fails because string is not empty it notToEqual "test_dir" // still evaluated even though `toBeEmpty()` already fails // use `.fileNameWithoutExtension` if you want a fail fast behaviour @@ -483,7 +483,7 @@ class PathExpectationSamples { val dir = tempDir.newDirectory("test_dir_1") val dir2 = tempDir.newDirectory("test_dir_2") - expect(dir) parent { // subject inside this block refers to path corresponding to `test_dir_1/..` + expect(dir) parent { // subject inside this expectation-group refers to path corresponding to `test_dir_1/..` it toEqual dir2.parent it toBe existing } // subject here is back to `test_dir_1` @@ -520,7 +520,7 @@ class PathExpectationSamples { val dir = tempDir.newDirectory("test_dir") val fileInDir = dir.newFile("test_file.txt") - expect(dir) resolve path("test_file.txt") { // subject inside this block refers to `test_dir/test_file.txt` + expect(dir) resolve path("test_file.txt") { // subject inside this expectation-group refers to `test_dir/test_file.txt` it toEqual fileInDir it toBe existing } // subject here is back to `test_dir` diff --git a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ZonedDateTimeExpectationSamples.kt b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ZonedDateTimeExpectationSamples.kt index 70972c8494..01b46be95f 100644 --- a/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ZonedDateTimeExpectationSamples.kt +++ b/apis/infix-en_GB/atrium-api-infix-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/infix/en_GB/samples/ZonedDateTimeExpectationSamples.kt @@ -26,14 +26,14 @@ class ZonedDateTimeExpectationSamples { @Test fun year() { expect(ZonedDateTime.of(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56), ZoneId.systemDefault())) year { - // subject inside this block is of type Int (actually 2021) + // subject inside this expectation-group is of type Int (actually 2021) it toEqual 2021 it toBeGreaterThan 2020 } // subject here is back to type ZonedDateTime fails { expect(ZonedDateTime.of(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56), ZoneId.systemDefault())) year { - // subject inside this block is of type Int (actually 2021) + // subject inside this expectation-group is of type Int (actually 2021) it notToEqual 2021 // fails it toBeGreaterThan 2022 // not evaluated/reported because notToEqual already fails // use `.year.` if you want a fail fast behaviour @@ -60,14 +60,14 @@ class ZonedDateTimeExpectationSamples { @Test fun month() { expect(ZonedDateTime.of(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56), ZoneId.systemDefault())) month { - // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) it toEqual Month.OCTOBER.value it notToEqual Month.SEPTEMBER.value } // subject here is back to type ZonedDateTime fails { expect(ZonedDateTime.of(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56), ZoneId.systemDefault())) month { - // subject inside this block is of type Int (actually Month.OCTOBER.value i.e. 10) + // subject inside this expectation-group is of type Int (actually Month.OCTOBER.value i.e. 10) it toBeLessThan 9 // fails it toBeGreaterThan 11 // still evaluated even though toBeLessThan already fails // use `.month` if you want a fail fast behaviour @@ -94,14 +94,14 @@ class ZonedDateTimeExpectationSamples { @Test fun dayOfWeek() { expect(ZonedDateTime.of(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56), ZoneId.systemDefault())) dayOfWeek { - // subject inside this block is of type DayOfWeek (actually SATURDAY) + // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) it toEqual DayOfWeek.SATURDAY it notToEqual DayOfWeek.SUNDAY } // subject here is back to type ZonedDateTime fails { expect(ZonedDateTime.of(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56), ZoneId.systemDefault())) dayOfWeek { - // subject inside this block is of type DayOfWeek (actually SATURDAY) + // subject inside this expectation-group is of type DayOfWeek (actually SATURDAY) it toEqual DayOfWeek.MONDAY // fails it notToEqual DayOfWeek.SATURDAY // still evaluated even though toEqual already fails // use `.dayOfWeek.` if you want a fail fast behaviour @@ -128,14 +128,14 @@ class ZonedDateTimeExpectationSamples { @Test fun day() { expect(ZonedDateTime.of(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56), ZoneId.systemDefault())) day { - // subject inside this block is of type Int (actually 9) + // subject inside this expectation-group is of type Int (actually 9) it toEqual 9 it toBeGreaterThan 5 } // subject here is back to type ZonedDateTime fails { expect(ZonedDateTime.of(LocalDateTime.of(2021, Month.OCTOBER, 9, 11, 56), ZoneId.systemDefault())) day { - // subject inside this block is of type Int (actually 9) + // subject inside this expectation-group is of type Int (actually 9) it toEqual 5 // fails it toBeLessThan 7 // still evaluated even though toEqual already fails // use `.day` if you want a fail fast behaviour diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/RepresentationOnlyAssertion.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/RepresentationOnlyAssertion.kt index 20b23973dc..48889ac6bd 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/RepresentationOnlyAssertion.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/RepresentationOnlyAssertion.kt @@ -6,7 +6,7 @@ package ch.tutteli.atrium.assertions * This assertion is typically used within an [AssertionGroup] where the description of the group gives enough context * so that it is enough if the assertion consists only of a representation of an instance. * - * For instance, representing `isNoneOf(1, 2, 3)` can be achieved with an assertion group and inner + * For instance, representing `isNoneOf(1, 2, 3)` can be achieved with an expectation-group and inner * [RepresentationOnlyAssertion]s. */ interface RepresentationOnlyAssertion : Assertion { diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/AssertionGroupDescriptionAndRepresentationOption.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/AssertionGroupDescriptionAndRepresentationOption.kt index 92804f50ce..e4fd37412a 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/AssertionGroupDescriptionAndRepresentationOption.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/AssertionGroupDescriptionAndRepresentationOption.kt @@ -71,7 +71,7 @@ interface AssertionGroupDescriptionAndRepresentationOption create( diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/explanatoryGroup.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/explanatoryGroup.kt index 56160db43c..7ed025b058 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/explanatoryGroup.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/assertions/builders/explanatoryGroup.kt @@ -63,7 +63,7 @@ interface ExplanatoryGroup { override val explanatoryAssertions: List /** - * Make the ExplanatoryGroup no longer hold, use this if the explanatory assertion group is a single assertion + * Make the ExplanatoryGroup no longer hold, use this if the explanatory expectation-group is a single assertion * within a group. */ override val failing: FinalStep get() = create(groupType, explanatoryAssertions, holds = false) @@ -202,7 +202,7 @@ interface ExplanatoryAssertionGroupFinalStep : AssertionBuilderFinalStep /** - * Make the ExplanatoryGroup no longer hold, use this if the explanatory assertion group is a single assertion + * Make the ExplanatoryGroup no longer hold, use this if the explanatory expectation-group is a single assertion * within a group. */ @Suppress("DEPRECATION") diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatter.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatter.kt index 77b4e37d9e..4f58643768 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatter.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatter.kt @@ -89,7 +89,7 @@ interface AssertionFormatter { * to format the given [assertionGroup] without problems. If [canFormat] returns `false` then this method should * throw an [UnsupportedOperationException]. * - * @param assertionGroup The assertion group which should be formatted. + * @param assertionGroup The expectation-group which should be formatted. * @param parameterObject The parameter object which contains inter alia the [sb][AssertionFormatterParameterObject.sb] * to which the result will be appended. * @param formatAssertions The function which should be called to format the diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterController.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterController.kt index b1aa7c02c3..79f8060b8c 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterController.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterController.kt @@ -22,9 +22,9 @@ interface AssertionFormatterController { * * Last but not least, an [AssertionFormatterController] has to take care of [AssertionGroup] with an * [InvisibleAssertionGroupType] as its [AssertionGroup.type]. Such groups should not be format as group but instead - * each [AssertionGroup.assertions] should be formatted. This also means, that if there are nested assertion groups + * each [AssertionGroup.assertions] should be formatted. This also means, that if there are nested expectation-groups * with an [InvisibleAssertionGroupType], that their [AssertionGroup.assertions] should be formatted as if they - * were all added directly in the surrounding assertion group. + * were all added directly in the surrounding expectation-group. * * @param assertion The assertion which shall be formatted. * @param parameterObject Used to share data between this [AssertionFormatterController] and the [register]ed @@ -48,7 +48,7 @@ interface AssertionFormatterController { * Checks whether the given [assertion] is an [AssertionGroup] and if its [type][AssertionGroup.type] * is an [ExplanatoryAssertionGroupType]. * - * @return `true` if it is an explanatory assertion group; `false` otherwise. + * @return `true` if it is an explanatory expectation-group; `false` otherwise. */ fun isExplanatoryAssertionGroup(assertion: Assertion) = assertion is AssertionGroup && assertion.type is ExplanatoryAssertionGroupType diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterParameterObject.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterParameterObject.kt index c0f2de386d..224d9fd6d0 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterParameterObject.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/AssertionFormatterParameterObject.kt @@ -108,7 +108,7 @@ class AssertionFormatterParameterObject private constructor( * Indicates that the formatting process is currently not formatting the [Assertion]s (or any nested assertion) * of an [AssertionGroup] of type [DoNotFilterAssertionGroupType]. * - * @return `true` if the formatting process is currently within an do not filter assertion group; `false` otherwise. + * @return `true` if the formatting process is currently within an do not filter expectation-group; `false` otherwise. */ fun isNotInDoNotFilterGroup() = numberOfDoNotFilterGroups == 0 @@ -117,7 +117,7 @@ class AssertionFormatterParameterObject private constructor( * Indicates that the formatting process is currently not formatting the [Assertion]s (or any nested assertion) * of an [AssertionGroup] of type [ExplanatoryAssertionGroupType]. * - * @return `true` if the formatting process is currently within an explanatory assertion group; `false` otherwise. + * @return `true` if the formatting process is currently within an explanatory expectation-group; `false` otherwise. */ fun isNotInExplanatoryFilterGroup() = numberOfExplanatoryGroups == 0 diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/impl/DefaultAssertionFormatterController.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/impl/DefaultAssertionFormatterController.kt index 6f52cebcfc..429696bb9f 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/impl/DefaultAssertionFormatterController.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/impl/DefaultAssertionFormatterController.kt @@ -31,8 +31,8 @@ class DefaultAssertionFormatterController : AssertionFormatterController { private fun noNeedToFormat(assertion: Assertion, parameterObject: AssertionFormatterParameterObject): Boolean { //assertionFilter only applies if: - // - we are not in an assertion group which should not be filtered (e.g. explanatory or summary group) and - // - if the given assertion is not an explanatory assertion group either. + // - we are not in an expectation-group which should not be filtered (e.g. explanatory or summary group) and + // - if the given assertion is not an explanatory expectation-group either. return parameterObject.isNotInDoNotFilterGroup() && !isExplanatoryAssertionGroup(assertion) && !parameterObject.assertionFilter(assertion) diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/SingleAssertionGroupTypeFormatter.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/SingleAssertionGroupTypeFormatter.kt index b199b8941d..26f65f62e1 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/SingleAssertionGroupTypeFormatter.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/SingleAssertionGroupTypeFormatter.kt @@ -48,7 +48,7 @@ abstract class SingleAssertionGroupTypeFormatter( * * If [assertionGroup] is *not* [T] or a sub type, then it throws an [UnsupportedOperationException]. * - * @param assertionGroup The assertion group which should be formatted. + * @param assertionGroup The expectation-group which should be formatted. * @param parameterObject The parameter object which contains inter alia the [sb][AssertionFormatterParameterObject.sb] * to which the result will be appended. * @param formatAssertions The function which should be called to format the @@ -83,7 +83,7 @@ abstract class SingleAssertionGroupTypeFormatter( * result to the [sb][AssertionFormatterParameterObject.sb] of the given [parameterObject] -- and returns the * [AssertionFormatterParameterObject] which shall be used for the [AssertionGroup.assertions]. * - * @param assertionGroup The assertion group which should be formatted. + * @param assertionGroup The expectation-group which should be formatted. * @param parameterObject The parameter object which contains inter alia the [sb][AssertionFormatterParameterObject.sb] * to which the result will be appended. * diff --git a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/TextExplanatoryAssertionGroupFormatter.kt b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/TextExplanatoryAssertionGroupFormatter.kt index 7ec965489d..0482a797bc 100644 --- a/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/TextExplanatoryAssertionGroupFormatter.kt +++ b/core/atrium-core-common/src/main/kotlin/ch/tutteli/atrium/reporting/text/impl/TextExplanatoryAssertionGroupFormatter.kt @@ -21,7 +21,7 @@ import kotlin.reflect.KClass * * @constructor Represents an [AssertionFormatter] which formats [AssertionGroup]s with an * [ExplanatoryAssertionGroupType] by defining only an [AssertionFormatterParameterObject] -- which indicates - * that we are in an explanatory assertion group and uses the `bulletPoints` (passed as argument) as prefix -- + * that we are in an explanatory expectation-group and uses the `bulletPoints` (passed as argument) as prefix -- * and completely ignoring [AssertionGroup.description] and [AssertionGroup.representation]. * * @param bulletPoints The formatter uses the bullet point defined for [WarningAssertionGroupType] diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/FeatureExtractor.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/FeatureExtractor.kt index 6dec399efd..1c2768399b 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/FeatureExtractor.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/FeatureExtractor.kt @@ -35,7 +35,7 @@ interface FeatureExtractor { * @param representationForFailure Representation in case the extraction cannot be carried out. * @param featureExtraction Extracts the feature where it returns the feature wrapped into a [Some] if the * extraction as such can be carried out, otherwise [None]. - * @param maybeSubAssertions Optionally, subsequent assertions for the feature (the new subject). + * @param maybeSubAssertions Optionally, subsequent expectations for the feature (the new subject). * This is especially useful if the extraction cannot be carried out, because this way we can then already * show to you (in error reporting) what you wanted to assert about the feature (which gives you more context to * the error). diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/SubjectChanger.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/SubjectChanger.kt index ad0d3c783c..2352ac2e94 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/SubjectChanger.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/SubjectChanger.kt @@ -64,7 +64,7 @@ interface SubjectChanger { * @param failureHandler The [FailureHandler] which shall be used in case the subject cannot be transformed. * A failure has the chance to augment the failing assertion representing the failed transformation with further * information. - * @param maybeSubAssertions Optionally, subsequent assertions for the new subject. This is especially useful if the + * @param maybeSubAssertions Optionally, subsequent expectations for the new subject. This is especially useful if the * change fails since we can then already show to you (in error reporting) what you wanted to assert about * the new subject (which gives you more context to the error). * diff --git a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/DefaultFeatureExtractor.kt b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/DefaultFeatureExtractor.kt index bdd4584908..474deca1c0 100644 --- a/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/DefaultFeatureExtractor.kt +++ b/logic/atrium-logic-common/src/main/kotlin/ch/tutteli/atrium/logic/creating/transformers/impl/DefaultFeatureExtractor.kt @@ -59,7 +59,7 @@ class DefaultFeatureExtractor : FeatureExtractor { // TODO 0.19.0: factor out in common pattern, should not be the concern of the average expectation // function writer container.maybeSubject.fold({ - // already in an explanatory assertion group, no need to wrap again + // already in an explanatory expectation-group, no need to wrap again container.collectForCompositionBasedOnSubject(None, assertionCreator) }, { listOf( @@ -79,7 +79,7 @@ class DefaultFeatureExtractor : FeatureExtractor { container.maybeSubject.fold({ // If the feature extraction fails because the subject is already None, then we don't need/want to // show the fixedClaimGroup in case it is empty because the feature as such will already be shown - // via explanatory assertion group + // via explanatory expectation-group if (featureAssertions.isNotEmpty()) { container.append(fixedClaimGroup) } diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt index 61e5a29032..5e81f2a6d0 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/SubjectLessSpec.kt @@ -73,7 +73,7 @@ abstract class SubjectLessSpec( }) { companion object { /** - * Calls recursively [AssertionGroup.assertions] on every assertion group contained in [assertions]. + * Calls recursively [AssertionGroup.assertions] on every expectation-group contained in [assertions]. */ private tailrec fun expandAssertionGroups(assertions: List) { if (assertions.isEmpty()) return diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/AnyExpectationsSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/AnyExpectationsSpec.kt index 82eadf2e4e..2903c1fc87 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/AnyExpectationsSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/integration/AnyExpectationsSpec.kt @@ -662,7 +662,7 @@ abstract class AnyExpectationsSpec( } } - it("$name - throws an AssertionError which contains subsequent assertions") { + it("$name - throws an AssertionError which contains subsequent expectations") { class A(val i: Int? = null) expect { expect(A()).feature(A::i).notToEqualNull { toBeLessThan(1) } diff --git a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/AssertionFormatterControllerSpec.kt b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/AssertionFormatterControllerSpec.kt index a97c285f6b..673d991bfb 100644 --- a/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/AssertionFormatterControllerSpec.kt +++ b/misc/specs/atrium-specs-common/src/main/kotlin/ch/tutteli/atrium/specs/reporting/AssertionFormatterControllerSpec.kt @@ -166,7 +166,7 @@ abstract class AssertionFormatterControllerSpec( ).forEach { (description, factories, prefix) -> val (holdingGroup, failingGroup) = factories context(description) { - it("appends the assertions without group header, if the assertion group holds") { + it("appends the assertions without group header, if the expectation-group holds") { testee.format(holdingGroup, parameterObject) expect(sb.toString()).toEqual( lineSeparator + @@ -174,7 +174,7 @@ abstract class AssertionFormatterControllerSpec( ) } - it("appends the assertions without group header, if the assertion group does not hold") { + it("appends the assertions without group header, if the expectation-group does not hold") { testee.format(failingGroup, parameterObject) expect(sb.toString()).toEqual( lineSeparator + @@ -197,7 +197,7 @@ abstract class AssertionFormatterControllerSpec( } context("first an ${ExplanatoryAssertionGroupType::class.simpleName} and then a regular assertion") { - it("appends only the explanatory assertion group") { + it("appends only the explanatory expectation-group") { val rootGroup = assertionBuilder.root .withDescriptionAndRepresentation(AssertionVerb.EXPECT, 5) .withAssertions( @@ -214,7 +214,7 @@ abstract class AssertionFormatterControllerSpec( } context("first a regular assertion, then an ${ExplanatoryAssertionGroupType::class.simpleName} and finally a regular assertion again") { - it("appends only the explanatory assertion group") { + it("appends only the explanatory expectation-group") { val rootGroup = assertionBuilder.root .withDescriptionAndRepresentation(AssertionVerb.EXPECT, 5) .withAssertions( @@ -231,7 +231,7 @@ abstract class AssertionFormatterControllerSpec( } } - context("an assertion group with assertions within an ${ExplanatoryAssertionGroupType::class.simpleName}") { + context("an expectation-group with assertions within an ${ExplanatoryAssertionGroupType::class.simpleName}") { val assertionGroup = assertionBuilder.list .withDescriptionAndRepresentation(AssertionVerb.EXPECT_THROWN, 2) .withAssertions(holdingAssertion, failingAssertion) @@ -241,7 +241,7 @@ abstract class AssertionFormatterControllerSpec( .withAssertions(listOf(assertionGroup, holdingAssertion)) .build() - it("appends the explanatory assertion group including all its assertions") { + it("appends the explanatory expectation-group including all its assertions") { val rootGroup = assertionBuilder.root .withDescriptionAndRepresentation(AssertionVerb.EXPECT, 5) .withAssertion(explanatoryAssertionGroup) @@ -257,7 +257,7 @@ abstract class AssertionFormatterControllerSpec( } context("within another ${ExplanatoryAssertionGroupType::class.simpleName} which is preceded and followed by a regular assertion ") { - it("appends the explanatory assertion group including all its assertions") { + it("appends the explanatory expectation-group including all its assertions") { val explanatoryAssertionGroup2 = assertionBuilder.explanatoryGroup .withWarningType .withAssertion(explanatoryAssertionGroup) @@ -293,8 +293,8 @@ abstract class AssertionFormatterControllerSpec( ) } - context("an assertion group with type ${SummaryAssertionGroupType::class.simpleName}") { - context("an assertion group with type ${InvisibleAssertionGroupType::class.simpleName} with two assertions") { + context("an expectation-group with type ${SummaryAssertionGroupType::class.simpleName}") { + context("an expectation-group with type ${InvisibleAssertionGroupType::class.simpleName} with two assertions") { it("appends both assertions, no header for group with ${InvisibleAssertionGroupType::class.simpleName}, and prefix holding/failing assertion accordingly") { val invisibleGroup: AssertionGroup = object : AssertionGroup { override val description = Untranslatable("test") diff --git a/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt b/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt index 9b7c46f87b..82f0c50080 100644 --- a/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt +++ b/misc/tools/readme-examples/src/main/kotlin/readme/examples/FeatureExtractorSpec.kt @@ -47,14 +47,14 @@ class FeatureExtractorSpec : Spek({ //@formatter:off test("ex-its-group") { - expect(myPerson) { // forms an assertion group block + expect(myPerson) { // forms an expectation-group - its({ firstName }) { // forms an assertion group block + its({ firstName }) { // forms an expectation-group toStartWith("Pe") // fails toEndWith("er") // is evaluated nonetheless } // fails as a whole - // still evaluated, as it is in outer assertion group block + // still evaluated, as it is in outer expectation-group its { lastName }.toEqual("Dummy") } } @@ -69,14 +69,14 @@ class FeatureExtractorSpec : Spek({ //@formatter:off test("ex-property-methods-group") { - expect(myPerson) { // forms an assertion group block + expect(myPerson) { // forms an expectation-group - feature({ f(it::firstName) }) { // forms an assertion group block + feature({ f(it::firstName) }) { // forms an expectation-group toStartWith("Pe") // fails toEndWith("er") // is evaluated nonetheless } // fails as a whole - // still evaluated, as it is in outer assertion group block + // still evaluated, as it is in outer expectation-group feature { f(it::lastName) }.toEqual("Dummy") } } @@ -115,7 +115,7 @@ class FeatureExtractorSpec : Spek({ feature(Pair::first) { toEqual(expected) } //snippet-within-funs-end - test("ex-within-assertion-functions") { + test("ex-within-expectation-functions") { //snippet-within-funs-insert expect(listOf(1 to "a", 2 to "b")).get(10) { diff --git a/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt b/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt index 40fd60b799..7b776e6299 100644 --- a/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt +++ b/misc/tools/readme-examples/src/main/kotlin/readme/examples/MostExamplesSpec.kt @@ -22,7 +22,7 @@ import java.math.BigDecimal class MostExamplesSpec : Spek({ test("ex-single") { - // two single assertions, only first evaluated + // two single expectations, only first evaluated expect(4 + 6).toBeLessThan(5).toBeGreaterThan(10) } @@ -38,7 +38,7 @@ class MostExamplesSpec : Spek({ } test("ex-group") { - // assertion group with two assertions, both evaluated + // expectation-group with two expectations, both evaluated expect(4 + 6) { toBeLessThan(5) toBeGreaterThan(10) @@ -63,7 +63,7 @@ class MostExamplesSpec : Spek({ test("ex-toThrow1") { expect { - // this block does something but eventually... + // this lambda does something but eventually... throw IllegalArgumentException("name is empty") }.toThrow() } @@ -71,15 +71,15 @@ class MostExamplesSpec : Spek({ test("ex-toThrow2") { expect { throw IllegalArgumentException() - }.toThrow().message.toStartWith("firstName") + }.toThrow { + message { toStartWith("firstName") } + } } test("ex-toThrow3") { expect { throw IllegalArgumentException() - }.toThrow { - message { toStartWith("firstName") } - } + }.toThrow().message.toStartWith("firstName") } test("ex-notToThrow") { @@ -89,27 +89,27 @@ class MostExamplesSpec : Spek({ }.notToThrow() } - test("ex-type-assertions-1") { - //snippet-type-assertions-insert - expect(x).toBeAnInstanceOf() - .feature { f(it::number) } - .toEqual(2) - } - test("ex-type-assertions-2") { + test("ex-type-expectations-1") { + //snippet-type-expectations-insert expect(x).toBeAnInstanceOf { feature { f(it::word) }.toEqual("goodbye") feature { f(it::flag) }.toEqual(false) } } + test("ex-type-expectations-2") { + expect(x).toBeAnInstanceOf() + .feature { f(it::number) } + .toEqual(2) + } test("ex-nullable-1") { - val slogan1: String? = "postulating assertions made easy" + val slogan1: String? = "postulating expectations made easy" expect(slogan1).toEqual(null) } test("ex-nullable-2") { val slogan2: String? = null - expect(slogan2).toEqual("postulating assertions made easy") + expect(slogan2).toEqual("postulating expectations made easy") } val slogan2: String? = null test("ex-nullable-3") { @@ -267,12 +267,12 @@ class MostExamplesSpec : Spek({ }) //@formatter:off -//snippet-type-assertions-start +//snippet-type-expectations-start interface SuperType data class SubType1(val number: Int) : SuperType data class SubType2(val word: String, val flag: Boolean) : SuperType val x: SuperType = SubType2("hello", flag = true) -//snippet-type-assertions-end +//snippet-type-expectations-end //@formatter:on diff --git a/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt b/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt index 687a2dbed8..e2e38b4f7f 100644 --- a/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt +++ b/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt @@ -100,7 +100,7 @@ object OwnExpectationFunctionsSpec : Spek({ //@formatter:off test("ex-own-compose-5"){ expect(Person("Susanne", "Whitley", 43, listOf(Person("Petra", "Whitley", 12, listOf())))) - .children { // using the fun -> assertion group, ergo sub-assertions don't fail fast + .children { // using the fun -> expectation-group, ergo sub expectations don't fail fast toHaveElementsAndNone { feature { f(it::firstName) }.toStartWith("Ro") } @@ -108,15 +108,11 @@ object OwnExpectationFunctionsSpec : Spek({ feature { f(it::lastName) }.toEqual("Whitley") } } // subject is still Person here - .apply { // only evaluated because the previous assertion group holds - children // using the val -> subsequent assertions are about children and fail fast - .toHaveSize(2) - .toHaveElementsAndAny { - feature { f(it::age) }.toBeGreaterThan(18) - } - } // subject is still Person here due to the `apply` - .children // using the val -> subsequent assertions are about children and fail fast - .toHaveSize(2) + .children // using the val -> subsequent expectations are about children and fail fast + .toHaveSize(2) + .toHaveElementsAndAny { + feature { f(it::age) }.toBeGreaterThan(18) + } } //@formatter:on diff --git a/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt b/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt index 4a53e29637..889fdc68c3 100644 --- a/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt +++ b/misc/verbs-internal/atrium-verbs-internal-common/src/main/kotlin/ch.tutteli.atrium.api.verbs.internal/atriumVerbs.kt @@ -35,7 +35,7 @@ fun expect(subject: T): RootExpect = * given [assertionCreator]-lambda where the created [Assertion]s are added as a group and reported as a whole. * * @param subject The subject for which we are going to postulate assertions. - * @param assertionCreator Assertion group block with a non-fail fast behaviour. + * @param assertionCreator expectation-group with a non-fail fast behaviour. * * @return The newly created [RootExpect]. * @throws AssertionError in case an assertion does not hold. diff --git a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt index 5cc2654b72..d4c879151f 100644 --- a/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt +++ b/misc/verbs/atrium-verbs-common/src/main/kotlin/ch/tutteli/atrium/api.verbs/expect.kt @@ -27,7 +27,7 @@ fun expect(subject: T): RootExpect = * [assertionCreator]-lambda creates as group to it. * * @param subject The subject for which we are going to postulate assertions. - * @param assertionCreator Assertion group block with a non-fail fast behaviour. + * @param assertionCreator expectation-group with a non-fail fast behaviour. * @return The newly created [Expect]. * @throws AssertionError in case an assertion does not hold. */ diff --git a/translations/en_GB/atrium-translations-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionBigDecimalAssertion.kt b/translations/en_GB/atrium-translations-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionBigDecimalAssertion.kt index 0cf37780f2..12d742ee55 100644 --- a/translations/en_GB/atrium-translations-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionBigDecimalAssertion.kt +++ b/translations/en_GB/atrium-translations-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/translations/DescriptionBigDecimalAssertion.kt @@ -13,7 +13,7 @@ import java.math.BigDecimal * Contains the [DescriptiveAssertion.description]s of the assertion functions which are applicable to [BigDecimal]. */ enum class DescriptionBigDecimalAssertion(override val value: String) : StringBasedTranslatable { - FAILURE_IS_EQUAL_INCLUDING_SCALE_BUT_NUMERICALLY_EQUAL("notice, if you used %s then the assertion would have hold."), + FAILURE_IS_EQUAL_INCLUDING_SCALE_BUT_NUMERICALLY_EQUAL("notice, if you used %s then the expectation would have been met."), IS_EQUAL_INCLUDING_SCALE("is equal (including scale)"), IS_NOT_EQUAL_INCLUDING_SCALE("is not equal (including scale)"), IS_NUMERICALLY_EQUAL_TO("is numerically equal to"),