Skip to content

Commit

Permalink
Merge pull request #858 from robstoll/remove-deprecated-stuff
Browse files Browse the repository at this point in the history
Remove deprecated stuff
  • Loading branch information
robstoll committed Apr 5, 2021
2 parents 97db672 + 180e0cc commit 564ef94
Show file tree
Hide file tree
Showing 97 changed files with 529 additions and 546 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: build
run: ./gradlew build

# TODO 0.17.0 or 0.18.0 re-activate scala API
# TODO 0.18.0 re-activate scala API
# - name: composite build atrium-scala2
# run: ./gradlew build
# working-directory: misc/tools/atrium-scala2-test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: ATRIUM_ANDROID_JAR="$PWD/android-jar-cache/android.jar" ./gradlew checkDexer
shell: bash

# TODO 0.17.0 or 0.18.0 re-activate scala API
# TODO 0.18.0 re-activate scala API
# - name: composite build atrium-scala2
# run: ./gradlew build
# working-directory: misc\tools\atrium-scala2-test
Expand Down
40 changes: 28 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2000,8 +2000,10 @@ This is kind of the simplest way of defining assertion functions. Following an e
<code-own-boolean-1>
```kotlin
import ch.tutteli.atrium.logic._logic
fun Expect<Int>.isMultipleOf(base: Int) =
createAndAddAssertion("is multiple of", base) { it % base == 0 }
_logic.createAndAppendAssertion("is multiple of", base) { it % base == 0 }
```
</code-own-boolean-1>
Expand All @@ -2012,7 +2014,7 @@ and its usage:
```kotlin
expect(12).isMultipleOf(5)
```
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L39)</sub> ↓ <sub>[Output](#ex-own-boolean-1)</sub>
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L44)</sub> ↓ <sub>[Output](#ex-own-boolean-1)</sub>
<a name="ex-own-boolean-1"></a>
```text
expected that subject: 12 (kotlin.Int <1234789>)
Expand Down Expand Up @@ -2048,8 +2050,10 @@ Consider the following assertion function:
<code-own-boolean-2>
```kotlin
import ch.tutteli.atrium.logic._logic
fun Expect<Int>.isEven() =
createAndAddAssertion("is", Text("an even number")) { it % 2 == 0 }
_logic.createAndAppendAssertion("is", Text("an even number")) { it % 2 == 0 }
```
</code-own-boolean-2>
Expand All @@ -2062,7 +2066,7 @@ Its usage looks then as follows:
```kotlin
expect(13).isEven()
```
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L50)</sub> ↓ <sub>[Output](#ex-own-boolean-2)</sub>
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L57)</sub> ↓ <sub>[Output](#ex-own-boolean-2)</sub>
<a name="ex-own-boolean-2"></a>
```text
expected that subject: 13 (kotlin.Int <1234789>)
Expand Down Expand Up @@ -2095,8 +2099,10 @@ if you want that both are evaluated:
<code-own-compose-2>

```kotlin
import ch.tutteli.atrium.logic._logic

fun <T : Date> Expect<T>.isBetween(lowerBoundInclusive: T, upperBoundExclusive: T) =
addAssertionsCreatedBy {
_logic.appendAssertionsCreatedBy {
isGreaterThanOrEqual(lowerBoundInclusive)
isLessThan(upperBoundExclusive)
}
Expand Down Expand Up @@ -2161,7 +2167,7 @@ Its usage is then as follows:
expect(Person("Susanne", "Whitley", 43, listOf()))
.hasNumberOfChildren(2)
```
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L67)</sub> ↓ <sub>[Output](#ex-own-compose-3)</sub>
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L74)</sub> ↓ <sub>[Output](#ex-own-compose-3)</sub>
<a name="ex-own-compose-3"></a>
```text
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[]) (readme.examples.Person <1234789>)
Expand Down Expand Up @@ -2195,7 +2201,7 @@ but we do not have to, as `all` already checks that there is at least one elemen
expect(Person("Susanne", "Whitley", 43, listOf()))
.hasAdultChildren()
```
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L82)</sub> ↓ <sub>[Output](#ex-own-compose-4)</sub>
↑ <sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L89)</sub> ↓ <sub>[Output](#ex-own-compose-4)</sub>
<a name="ex-own-compose-4"></a>
```text
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[]) (readme.examples.Person <1234789>)
Expand Down Expand Up @@ -2237,7 +2243,7 @@ expect(Person("Susanne", "Whitley", 43, listOf(Person("Petra", "Whitley", 12, li
.children // using the val -> subsequent assertions are about children and fail fast
.hasSize(2)
```
<sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L92)</sub> ↓ <sub>[Output](#ex-own-compose-5)</sub>
<sub>[Example](https://github.com/robstoll/atrium/tree/master/misc/tools/readme-examples/src/main/kotlin/readme/examples/OwnExpectationFunctionsSpec.kt#L99)</sub> ↓ <sub>[Output](#ex-own-compose-5)</sub>
<a name="ex-own-compose-5"></a>
```text
expected that subject: Person(firstName=Susanne, lastName=Whitley, age=43, children=[Person(firstName=Petra, lastName=Whitley, age=12, children=[])]) (readme.examples.Person <1234789>)
Expand Down Expand Up @@ -2458,8 +2464,13 @@ we do no longer use a `String` but a proper `Translatable`.
<code-i18n-1>

```kotlin
fun Expect<Int>.isMultipleOf(base: Int): Expect<Int> =
createAndAddAssertion(DescriptionIntAssertion.IS_MULTIPLE_OF, base) { it % base == 0 }
import ch.tutteli.atrium.logic.*

fun Expect<Int>.isMultipleOf(base: Int): Expect<Int> = _logic.run {
appendAssertion(
createDescriptiveAssertion(DescriptionIntAssertion.IS_MULTIPLE_OF, base) { it % base == 0 }
)
}

enum class DescriptionIntAssertion(override val value: String) : StringBasedTranslatable {
IS_MULTIPLE_OF("is multiple of")
Expand Down Expand Up @@ -2505,8 +2516,13 @@ as second example:
<code-i18n-2>

```kotlin
fun Expect<Int>.isEven(): Expect<Int> =
createAndAddAssertion(DescriptionBasic.IS, DescriptionIntAssertions.EVEN) { it % 2 == 0 }
import ch.tutteli.atrium.logic.*

fun Expect<Int>.isEven(): Expect<Int> = _logic.run {
appendAssertion(
createDescriptiveAssertion(DescriptionBasic.IS, DescriptionIntAssertions.EVEN) { it % 2 == 0 }
)
}

enum class DescriptionIntAssertions(override val value: String) : StringBasedTranslatable {
EVEN("an even number")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ inline val <T> Expect<T>.and: Expect<T> get() = this
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.deprecated.AnyAssertionSamples.and
*/
infix fun <T> Expect<T>.and(assertionCreator: Expect<T>.() -> Unit): Expect<T> =
addAssertionsCreatedBy(assertionCreator)
_logic.appendAssertionsCreatedBy(assertionCreator)

/**
* Expects that the subject of `this` expectation is not (equal to) [expected] and [otherValues].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fun <E> Expect<out Array<out E>>.asList(): Expect<List<E>> =
* @sample ch.tutteli.atrium.api.fluent.en_GB.samples.deprecated.ArrayAssertionSamples.asList
*/
fun <E> Expect<Array<E>>.asList(assertionCreator: Expect<List<E>>.() -> Unit): Expect<Array<E>> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }

/**
* Expects that the subject of `this` expectation holds all assertions the given [assertionCreator] creates for
Expand All @@ -51,7 +51,7 @@ fun <E> Expect<Array<E>>.asList(assertionCreator: Expect<List<E>>.() -> Unit): E
*/
@JvmName("asListEOut")
fun <E> Expect<Array<out E>>.asList(assertionCreator: Expect<List<E>>.() -> Unit): Expect<Array<out E>> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }

/**
* Turns `Expect<CharArray>` into `Expect<List<Byte>>`.
Expand Down Expand Up @@ -84,7 +84,7 @@ fun Expect<ByteArray>.asList(): Expect<List<Byte>> =
*/
@JvmName("byteArrAsList")
fun Expect<ByteArray>.asList(assertionCreator: Expect<List<Byte>>.() -> Unit): Expect<ByteArray> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }


/**
Expand Down Expand Up @@ -118,7 +118,7 @@ fun Expect<CharArray>.asList(): Expect<List<Char>> =
*/
@JvmName("charArrAsList")
fun Expect<CharArray>.asList(assertionCreator: Expect<List<Char>>.() -> Unit): Expect<CharArray> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }


/**
Expand Down Expand Up @@ -152,7 +152,7 @@ fun Expect<ShortArray>.asList(): Expect<List<Short>> =
*/
@JvmName("shortArrAsList")
fun Expect<ShortArray>.asList(assertionCreator: Expect<List<Short>>.() -> Unit): Expect<ShortArray> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }


/**
Expand Down Expand Up @@ -186,7 +186,7 @@ fun Expect<IntArray>.asList(): Expect<List<Int>> =
*/
@JvmName("intArrAsList")
fun Expect<IntArray>.asList(assertionCreator: Expect<List<Int>>.() -> Unit): Expect<IntArray> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }


/**
Expand Down Expand Up @@ -220,7 +220,7 @@ fun Expect<LongArray>.asList(): Expect<List<Long>> =
*/
@JvmName("longArrAsList")
fun Expect<LongArray>.asList(assertionCreator: Expect<List<Long>>.() -> Unit): Expect<LongArray> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }


/**
Expand Down Expand Up @@ -254,7 +254,7 @@ fun Expect<FloatArray>.asList(): Expect<List<Float>> =
*/
@JvmName("floatArrAsList")
fun Expect<FloatArray>.asList(assertionCreator: Expect<List<Float>>.() -> Unit): Expect<FloatArray> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }


/**
Expand Down Expand Up @@ -288,7 +288,7 @@ fun Expect<DoubleArray>.asList(): Expect<List<Double>> =
*/
@JvmName("doubleArrAsList")
fun Expect<DoubleArray>.asList(assertionCreator: Expect<List<Double>>.() -> Unit): Expect<DoubleArray> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }


/**
Expand Down Expand Up @@ -321,4 +321,4 @@ fun Expect<BooleanArray>.asList(): Expect<List<Boolean>> =
*/
@JvmName("boolArrAsList")
fun Expect<BooleanArray>.asList(assertionCreator: Expect<List<Boolean>>.() -> Unit): Expect<BooleanArray> =
apply { asList().addAssertionsCreatedBy(assertionCreator) }
apply { asList()._logic.appendAssertionsCreatedBy(assertionCreator) }

This file was deleted.

Loading

0 comments on commit 564ef94

Please sign in to comment.