Platform (jvm, js, android): jvm
Extension (none, kotlin 1.3, jdk8): kotlin 1.3
Similar as #113
expect(Result.success(1)).isSuccess()
expect(Result.success(1)).isSuccess {
isGreaterThan(1)
isLessThan(5)
}
//instead of
expect(Result.success(1)).feature { f(it::getOrNull) }.notToBeNull()
expect(Result.success(1)).feature({ f(it::getOrNull) }.notToBeNull {
isGreaterThan(1)
isLessThan(5)
}
However in reporting we want to see for
expect(Result.failure<Int>(IllegalArgumentException())).isSuccess()
the following
expect: Failure(java.lang.IllegalArgumentException) (kotlin.Result <1651855867>)
◆ unboxed: !! not a Success
And for
expect(Result.failure<Int>(IllegalArgumentException())).isSuccess {
isGreaterThan(1)
isLessThan(5)
}
the following
expect: Failure(java.lang.IllegalArgumentException) (kotlin.Result <459857341>)
◆ ▶ unboxed: !! not a Success
» is greater than: 1 (kotlin.Int <1392425346>)
» is less than: 5 (kotlin.Int <2054574951>)
And for
expect(Result.success(0)).isSuccess {
isGreaterThan(1)
isLessThan(5)
}
the following:
expect: Success(0) (kotlin.Result <1518864111>)
◆ ▶ unboxed: 0 (kotlin.Int <1685232414>)
◾ is greater than: 1 (kotlin.Int <1754638213>)
Following the things you need to do:
domain
isSuccess which returns ExtractedFeaturePostStep<T, E> whereT: Resultlib
ExpectImpl.feature.extractor...api
assertionCreator-lambda and returns Expect@since 0.9.0 (adopt to next release version) to KDOC of val and funI'll work on this if you would like to take this issue over.I will work on this
A couple of things here
1) There is no class : ExtractedFeatureOption so using ExtractedFeaturePostStep.
2) After referring to the implementation of get in listAssertions,
For the method _isSuccess() in file resultsAssertions.kt, after line 15, i have to write .withRepresentationForFailure(). And can you suggest me a parameter in that option, as there is no DescriptionListAssertion equivalent for result assertions
ps: I have updated the description for domain, note that you have to register ResultAssertionsImpl as service
@robstoll :
DescriptionResultAssertion.kt in en_GB for now. Please let me know if it is ok. _isSuccess(), but I am getting an error asExtractedFeaturePostStep<T, E>ExtractedFeaturePostStep<T, E?>I have a small idea about the null saftey in kotlin, but I couldn't think of a way to fix this one.

See review in the PR and please open up a new one where your PR is based on the latest version of the master branch (also see link in the PR for help)
I have created a new PR with the mentioned changes.
expect: Failure(java.lang.IllegalArgumentException) (kotlin.Result <1651855867>)
◆ unboxed: !! not a Success
However I think that even Using unboxed here is not 100% clear for some one who is using this feature for the 1st time.
I am not sure what could be the correct word there, I think it could be.
expect: Failure(java.lang.IllegalArgumentException) (kotlin.Result <1651855867>)
◆ The result is : not a Success
Also when I run a build I get an error :
Task :atrium-domain-robstoll-js:compileKotlin2Js FAILED
e: D:\SRH\shardulsonar-atrium\domain\robstoll\atrium-domain-robstoll-js\src\main\kotlin\ch\tutteli\atrium\domain\robstoll\registerServices.kt: (40, 46): Unresolved reference: kotlin_1_3
e: D:\SRH\shardulsonar-atrium\domain\robstoll\atrium-domain-robstoll-js\src\main\kotlin\ch\tutteli\atrium\domain\robstoll\registerServices.kt: (40, 120): Unresolved reference: kotlin_1_3
However I think that even Using unboxed here is not 100% clear for some one who is using this feature for the 1st time.
I think you are right as unboxed does not include the assumption of the developer that it is a Success. The same goes for your suggestion The result is IMO. What do you think about the following two? Which one do you like more:
expect: Failure(java.lang.IllegalArgumentException) (kotlin.Result <1651855867>)
◆ unboxed Success: !! not a Success
Or
expect: Failure(java.lang.IllegalArgumentException) (kotlin.Result <1651855867>)
â—† value: !! cannot access `value` as it is no a Success
I would suggest we use this :
expect: Failure(java.lang.IllegalArgumentException) (kotlin.Result <1651855867>)
â—† value: !! cannot access `value` as it is no a Success
Good, let me know when I shall re-review your WIP and keep on having fun coding 🙂
I have pushed the code and resolved the comments that were suggested earlier.
But I still have an issue with the building of the application. I have mentioned it in the WIP Pull Request.
@robstoll
I have added all the changes mentioned (except the test cases).
But now I have 3 Issues :
1) _I am getting a compilation error on the _isSuccess() implementation_
Required : ExtractedFeaturePostStep
Found : ExtractedFeaturePostStep
2) _I am unable to build the project (./gr build) :_
Task :atrium-api-fluent-en_GB-kotlin_1_3-jvm:compileKotlin FAILED
e: D:\SRH\shardulsonar-atrium\apis\fluent-en_GB\extensions\kotlin_1_3\atrium-api-fluent-en_GB-kotlin_1_3-common\src\main\kotlin\ch\tutteli\atrium\api\fluent\en_GB\kotlin_1_3\resultAssertions.kt: (14, 70): Symbol is declared in module 'ch.tutteli.atrium.domain.builders.kotlin_1_3' which does not export package 'ch.tutteli.atrium.domain.builders.kotlin_1_3'
e: D:\SRH\shardulsonar-atrium\apis\fluent-en_GB\extensions\kotlin_1_3\atrium-api-fluent-en_GB-kotlin_1_3-common\src\main\kotlin\ch\tutteli\atrium\api\fluent\en_GB\kotlin_1_3\resultAssertions.kt: (24, 16): Symbol is declared in module 'ch.tutteli.atrium.domain.builders.kotlin_1_3' which does not export package 'ch.tutteli.atrium.domain.builders.kotlin_1_3'
When I run generateJsRegisterNewServices (./gr generateJsRegisterServices) :
I get an error as
3) _Another problem was found with the configuration of task ':atrium-domain-robstoll-kotlin_1_3-js:generateJsRegisterServices'._
File 'D:\SRH\shardulsonar-atrium\domain\robstoll\extensions\kotlin_1_3\atrium-domain-robstoll-kotlin_1_3-js\src\main\kotlin\ch\tutteli\atrium\domain\kotlin_1_3\registerServices.kt' specified for property '$2' does not exist.
Here the $2 means the
createRegisterJsServicesTask('domain-robstoll-kotlin_1_3-js', 'ch.tutteli.atrium.domain.kotlin_1_3') { true }
on the build.gradle file
I am unable to figure out how to fix this build issue .
Whenever you have time, could you please have a look at my branch and let me know what is going wrong ?
Thanks for your help
Implemented with 6ef99c01