Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated modules, ReportFactory, ExpectBuilder and dependOnMe #856

Merged
merged 1 commit into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2335,16 +2335,12 @@ Unfortunately we do not have the time to cover all cases, so let us know if you
## Own Sophisticated Assertion Builders

Do you want to write an own sophisticated assertion builder (or extend a current with more options) instead of an assertion function?
Great, we do not provide documentation yet (had only one question about it so far).
Therefore, please have a look at the implementation, for instance how the sophisticated assertion builders for `Iterable<T>` are defined:
[ch.tutteli.atrium.creating.iterable.contains](https://github.com/robstoll/atrium/tree/master/domain/api/atrium-domain-api-common/src/main/kotlin/ch/tutteli/atrium/domain/creating/iterable/contains).
Notice that the implementation supports [Internationalization](#internationalization-1).
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).
In the meantime we might help you via slack, please post your questions in the [atrium Slack channel](https://kotlinlang.slack.com/messages/C887ZKGCQ)
([Invite yourself](https://slack.kotlinlang.org/) in case you do not have an account yet).


# Use own Assertion Verbs

Atrium offers three assertion verbs out of the box: `expect`, `assert` and `assertThat`.
Expand Down
22 changes: 10 additions & 12 deletions apis/differences.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ Atrium provides so called bundle-modules which merely bundle dependencies (they
These modules bundle:
- an API module
- a translation module (the language used in reporting)
- an implementation of the domain of Atrium
- an implementation of the core of Atrium

- predefined expectation verbs.

Following a list of the available bundle-modules.
The links point to the KDoc of their included API where you find an overview of all available assertion functions of the API.
The links point to the KDoc of their included API where you find an overview of all available expectation functions of the API.

- [atrium-fluent-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.fluent.en_-g-b/index.html)
- [atrium-infix-en_GB](https://docs.atriumlib.org/latest#/doc/ch.tutteli.atrium.api.infix.en_-g-b/index.html)
Expand All @@ -39,7 +37,7 @@ If you forget to dit it, then the compiler will complain that you have the same

Atrium currently provides two API styles: fluent and infix.
We dit not show every single difference but merely where the APIs differ in naming.
For instance, the assertion function `Expect<T>.toBe`:
For instance, the expectation function `Expect<T>.toBe`:

*atrium-api-fluent-en_GB*
```kotlin
Expand All @@ -60,7 +58,7 @@ is toit similar, we will not list it here (ok, we did now but I guess you get th
- [in any order](#iterable-contains-in-any-order)
- [in order](#iterable-contains-in-order)
- [Iterable contains not](#iterable-contains-not)
- [Iterable predicate-like assertions](#iterable-predicate-like-assertions)
- [Iterable predicate-like expectations](#iterable-predicate-like-expectations)
- [List get](#list-get)
- [Map getExisting](#map-getexisting)
- [Map contains](#map-contains)
Expand Down Expand Up @@ -111,7 +109,7 @@ expect(x).contains.ignoringCase.notOrAtMost(1).elementsOf(anIterable)
```
Notice that the final steps
`value`, `values` and `regex`
in the sophisticated assertion building process
in the sophisticated expectation building process
are applicable to all shown examples
(e.g. `exactly(1).values("hello", "robert")` could have been finished with `exactly(1).regex("h(e|a)llo")` as well).

Expand All @@ -128,7 +126,7 @@ expect(x) contains o ignoring case notOrAtMost 1 elementsOf anIterable
```
Notice that the final steps
`value`, `values(...)`, `regex` and `regexPatterns(..)`
in the sophisticated assertion building process
in the sophisticated expectation building process
are applicable to all shown examples
(e.g. `exactly 1 values("hello", "robert")` could have been finished with `exactly 1 regex "h(e|a)llo"` as well).

Expand All @@ -154,7 +152,7 @@ expect(x).contains.inAnyOrder.only.entries({ toBe(3) }, { isLessThan(2) })
```
Notice that the final steps
`value`, `values`, `entry` and `entries`
in the sophisticated assertion building process
in the sophisticated expectation building process
are applicable to all shown examples
(e.g. `butAtMost(2).value(3.2)` could have been finished with `entries(...)` as well)

Expand All @@ -178,7 +176,7 @@ Note that `o` is a filler object which is only there so that we can turn extensi
a method with one parameter and thus make it available as infix method.

The final steps `value`, `values(...)`, `entry` and `entries(...)`
in the sophisticated assertion building process,
in the sophisticated expectation building process,
are applicable to all shown examples
(e.g. `butAtMost 2 value 3.2` could have been finished with `entries(...)` as well)

Expand Down Expand Up @@ -257,8 +255,8 @@ expect(x) containsNot o entry { it isLessThan 2 }
expect(x) containsNot o the entries(null, { it isLessThan 2 }, { it isGreaterThan 5 })
```

# Iterable predicate-like assertions
For more sophisticated assertions such as "there should be two matches", use the sophisticated assertion builder `contains.inAnyOrder`
# Iterable predicate-like expectations
For more sophisticated expectations such as "there should be two matches", use the sophisticated expectation builder `contains.inAnyOrder`
-&gt; see [Iterable contains in any order](#iterable-contains-in-any-order) for more information

*atrium-api-fluent-en_GB*
Expand Down

This file was deleted.

16 changes: 0 additions & 16 deletions apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,10 @@ ext.jacoco_additional = [
prefixedProject('translations-en_GB-jvm'),
prefixedProject('logic-jvm'),
prefixedProject('core-api-jvm'),
//TODO remove with 0.17.0
prefixedProject('domain-builders-jvm'),
prefixedProject('domain-robstoll-jvm'),
prefixedProject('domain-robstoll-lib-jvm'),
prefixedProject('domain-api-jvm'),
prefixedProject('core-robstoll-jvm'),
prefixedProject('core-robstoll-lib-jvm'),
]

dependencies {
api prefixedProject('logic-jvm')

testImplementation prefixedProject('specs-jvm')
}


//TODO 0.17.0 or 0.18.0 should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
compileTestKotlin.dependsOn(
prefixedProject('core-robstoll-jvm').compileKotlin,
prefixedProject('core-robstoll-jvm').processResources,
prefixedProject('domain-robstoll-jvm').compileKotlin,
prefixedProject('domain-robstoll-jvm').processResources
)
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
description = 'Kotlin 1.3 specific assertion functions and builders for fluent-en_GB -- will be merged into fluent-en_GB with 1.0.0'

ext.jacoco_additional = [
prefixedProject('domain-builders-jvm'),
prefixedProject('domain-robstoll-jvm'),
prefixedProject('domain-robstoll-lib-jvm'),
prefixedProject('core-robstoll-jvm'),
prefixedProject('core-robstoll-lib-jvm'),
prefixedProject('logic-kotlin_1_3-jvm'),
]

dependencies {
Expand All @@ -14,12 +10,3 @@ dependencies {

testImplementation prefixedProject('specs-jvm')
}


//TODO 0.17.0 or 0.18.0 should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
compileTestKotlin.dependsOn(
prefixedProject('core-robstoll-jvm').compileKotlin,
prefixedProject('core-robstoll-jvm').processResources,
prefixedProject('domain-robstoll-jvm').compileKotlin,
prefixedProject('domain-robstoll-jvm').processResources
)

This file was deleted.

16 changes: 0 additions & 16 deletions apis/infix-en_GB/atrium-api-infix-en_GB-jvm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ ext.jacoco_additional = [
prefixedProject('translations-de_CH-jvm'),
prefixedProject('logic-jvm'),
prefixedProject('core-api-jvm'),
//TODO remove with 0.17.0
prefixedProject('domain-builders-jvm'),
prefixedProject('domain-robstoll-jvm'),
prefixedProject('domain-robstoll-lib-jvm'),
prefixedProject('domain-api-jvm'),
prefixedProject('core-robstoll-jvm'),
prefixedProject('core-robstoll-lib-jvm'),
]

dependencies {
Expand All @@ -21,12 +14,3 @@ dependencies {
}
testImplementation prefixedProject('translations-de_CH-jvm')
}


//TODO 0.17.0 or 0.18.0 should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
compileTestKotlin.dependsOn(
prefixedProject('core-robstoll-jvm').compileKotlin,
prefixedProject('core-robstoll-jvm').processResources,
prefixedProject('domain-robstoll-jvm').compileKotlin,
prefixedProject('domain-robstoll-jvm').processResources
)
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
description = 'Kotlin 1.3 specific assertion functions and builders for infix-en_GB -- will be merged into infix-en_GB with 1.0.0'

ext.jacoco_additional = [
prefixedProject('domain-builders-jvm'),
prefixedProject('domain-robstoll-jvm'),
prefixedProject('domain-robstoll-lib-jvm'),
prefixedProject('core-robstoll-jvm'),
prefixedProject('core-robstoll-lib-jvm'),
prefixedProject('logic-kotlin_1_3-jvm'),
]

dependencies {
Expand All @@ -14,12 +10,3 @@ dependencies {

testImplementation prefixedProject('specs-jvm')
}


//TODO 0.17.0 or 0.18.0 should not be necessary https://youtrack.jetbrains.com/issue/KT-28124
compileTestKotlin.dependsOn(
prefixedProject('core-robstoll-jvm').compileKotlin,
prefixedProject('core-robstoll-jvm').processResources,
prefixedProject('domain-robstoll-jvm').compileKotlin,
prefixedProject('domain-robstoll-jvm').processResources
)
70 changes: 3 additions & 67 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,7 @@ buildscript {
!(it.projectDir.path.contains("/translations/") || it.projectDir.path.contains("\\translations\\")) &&
!it.name.endsWith("-common") &&
!it.name.endsWith("-js") &&
it.name != "${rootProject.name}-domain-api-jvm" &&
it.name != "${rootProject.name}-core-robstoll-jvm" &&
!it.name.startsWith("${rootProject.name}-specs") &&
//TODO remove with 0.17.0
it.name != "${rootProject.name}-domain-robstoll-jvm" &&
it.name != "${rootProject.name}-domain-builders-jvm"
!it.name.startsWith("${rootProject.name}-specs")
}
]
}
Expand Down Expand Up @@ -319,67 +314,8 @@ configure(bundleSmokeTests) {

import java.nio.file.Files
import java.nio.file.Paths
import java.util.function.Function
import java.util.stream.Collectors

def createRegisterJsServicesTask(String projectName, String packageName, Function<String, Boolean> filter) {
Project project = prefixedProject(projectName)
configure(project) {
def registerJsServices = project.tasks.create(name: 'generateJsRegisterServices', group: 'build') {
def jvm = "${getProjectNameWithoutSuffix(project)}-jvm"
def servicesDir = project.file("../$jvm/src/main/resources/META-INF/services/")
def services = project.file("$srcKotlin/${packageName.replace('.', '/')}/registerServices.kt")
inputs.dir servicesDir
outputs.file services

doLast {
services.write("""\
@file:Suppress("DEPRECATION")

package $packageName

import ch.tutteli.atrium.core.polyfills.registerService

@Suppress("unused" /* here in order that the code is executed when module is loaded */)
private val register = run {
""".stripIndent())
def sortedMap = new TreeMap<String, String>()
servicesDir.traverse {
if (it.isFile() && filter.apply(it.name)) {
sortedMap.put(it.name, it.withReader { it.readLine() })
}
}
sortedMap.each { entry ->
services.append("\n registerService<")
services.append(entry.key)
services.append("> { ")
services.append(entry.value)
services.append("() }")
}
services.append("\n}\n")
}
}
compileKotlin2Js.dependsOn registerJsServices
}
}

//TODO remove with 0.17.0
createRegisterJsServicesTask('core-robstoll-js', 'ch.tutteli.atrium.core.robstoll') { true }
createRegisterJsServicesTask('domain-builders-js', 'ch.tutteli.atrium.domain.builders') { true }
createRegisterJsServicesTask('domain-robstoll-js', 'ch.tutteli.atrium.domain.robstoll') {
!(it in [
'ch.tutteli.atrium.domain.creating.BigDecimalAssertions',
'ch.tutteli.atrium.domain.creating.OptionalAssertions',
'ch.tutteli.atrium.domain.creating.PathAssertions',
'ch.tutteli.atrium.domain.creating.LocalDateAssertions',
'ch.tutteli.atrium.domain.creating.LocalDateTimeAssertions',
'ch.tutteli.atrium.domain.creating.ZonedDateTimeAssertions',
'ch.tutteli.atrium.domain.creating.ChronoLocalDateAssertions',
'ch.tutteli.atrium.domain.creating.ChronoLocalDateTimeAssertions',
'ch.tutteli.atrium.domain.creating.ChronoZonedDateTimeAssertions'
])
}

List<Project> projectNamesToProject(String[] names) {
names.collect { projectName -> prefixedProject(projectName) }
}
Expand Down Expand Up @@ -430,10 +366,10 @@ def createJsTestTask(String... subprojectNames) {

createJsTestTask(
'core-api-js',
'core-robstoll-lib-js',
'api-fluent-en_GB-js',
'api-infix-en_GB-js',
'fluent-en_GB-js'
'fluent-en_GB-js',
'infix-en_GB-js'
)

def useJupiter(String... projectNames) {
Expand Down
6 changes: 0 additions & 6 deletions bundles/fluent-en_GB/atrium-fluent-en_GB-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@ dependencies {
api prefixedProject('verbs-common')
api prefixedProject('api-fluent-en_GB-common')
api prefixedProject('translations-en_GB-common')
api prefixedProject('domain-builders-common')
api prefixedProject('domain-api-common')
api prefixedProject('core-api-common')

runtimeOnly prefixedProject('domain-robstoll-common')
runtimeOnly prefixedProject('core-robstoll-common')
}
6 changes: 0 additions & 6 deletions bundles/fluent-en_GB/atrium-fluent-en_GB-js/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@ dependencies {
api prefixedProject('verbs-js')
api prefixedProject('api-fluent-en_GB-js')
api prefixedProject('translations-en_GB-js')
api prefixedProject('domain-builders-js')
api prefixedProject('domain-api-js')
api prefixedProject('core-api-js')

implementation prefixedProject('domain-robstoll-js')
implementation prefixedProject('core-robstoll-js')
}

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions bundles/fluent-en_GB/atrium-fluent-en_GB-jvm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,10 @@ ext.jacoco_additional = [
prefixedProject('translations-en_GB-jvm'),
prefixedProject('logic-jvm'),
prefixedProject('core-api-jvm'),
//TODO remove with 0.17.0
prefixedProject('domain-builders-jvm'),
prefixedProject('domain-robstoll-jvm'),
prefixedProject('domain-robstoll-lib-jvm'),
prefixedProject('domain-api-jvm'),
prefixedProject('core-robstoll-jvm'),
prefixedProject('core-robstoll-lib-jvm'),
]

dependencies {
api prefixedProject('verbs-jvm')
api prefixedProject('api-fluent-en_GB-jvm')
api prefixedProject('translations-en_GB-jvm')
api prefixedProject('domain-builders-jvm')
api prefixedProject('domain-api-jvm')
api prefixedProject('core-api-jvm')

runtimeOnly prefixedProject('domain-robstoll-jvm')
runtimeOnly prefixedProject('core-robstoll-jvm')
}
Loading