Skip to content

Commit 85d8c0e

Browse files
committed
[raise-dsl-assertions] Updated documentation
1 parent 2e1d03e commit 85d8c0e

19 files changed

+62
-4
lines changed

src/main/kotlin/in/rcard/assertj/arrowcore/AbstractEitherAssert.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import org.assertj.core.internal.StandardComparisonStrategy
1818
* @param LEFT type of the left value contained in the [Either].
1919
* @param RIGHT type of the right value contained in the [Either].
2020
* @author Riccardo Cardin
21+
* @author Simon Frost
22+
*
23+
* @since 0.0.1
2124
*/
2225
abstract class AbstractEitherAssert<
2326
SELF : AbstractEitherAssert<SELF, LEFT, RIGHT>, LEFT : Any, RIGHT : Any,

src/main/kotlin/in/rcard/assertj/arrowcore/AbstractOptionAssert.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import org.assertj.core.internal.StandardComparisonStrategy
1515
* @param SELF the "self" type of this assertion class.
1616
* @param VALUE type of the value contained in the [Option].
1717
* @author Riccardo Cardin
18+
* @author Simon Frost
19+
* @since 0.0.1
1820
*/
1921
abstract class AbstractOptionAssert<
2022
SELF : AbstractOptionAssert<SELF, VALUE>, VALUE : Any,

src/main/kotlin/in/rcard/assertj/arrowcore/AbstractRaiseAssert.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import org.assertj.core.internal.StandardComparisonStrategy
1616
* @param VALUE type of the value returned by the function.
1717
* @param ERROR type of the logical error raised by the function.
1818
* @author Riccardo Cardin
19-
*
2019
* @since 0.2.0
2120
*/
2221
abstract class AbstractRaiseAssert<
@@ -26,6 +25,10 @@ abstract class AbstractRaiseAssert<
2625

2726
private val comparisonStrategy: ComparisonStrategy = StandardComparisonStrategy.instance()
2827

28+
/**
29+
* Verifies that the function in the [Raise] context succeeds with the given value.
30+
* @param expectedValue the expected value returned by the function.
31+
*/
2932
fun succeedsWith(expectedValue: VALUE) {
3033
fold(
3134
block = actual,
@@ -38,6 +41,10 @@ abstract class AbstractRaiseAssert<
3841
)
3942
}
4043

44+
/**
45+
* Verifies that the function in the [Raise] context fails with the given error.
46+
* @param expectedError the expected error raised by the function.
47+
*/
4148
fun raises(expectedError: ERROR) {
4249
fold(
4350
block = actual,

src/main/kotlin/in/rcard/assertj/arrowcore/EitherAssert.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import arrow.core.Either
88
* @param LEFT type of the value on the left contained in the [Either].
99
* @param RIGHT type of the value on the right contained in the [Either].
1010
* @author Riccardo Cardin
11+
* @since 0.0.1
1112
*/
1213
class EitherAssert<LEFT : Any, RIGHT : Any>(either: Either<LEFT, RIGHT>?) :
1314
AbstractEitherAssert<EitherAssert<LEFT, RIGHT>, LEFT, RIGHT>(either) {

src/main/kotlin/in/rcard/assertj/arrowcore/OptionAssert.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import arrow.core.Option
77
*
88
* @param VALUE type of the value contained in the [Option].
99
* @author Riccardo Cardin
10+
* @since 0.0.1
1011
*/
1112
class OptionAssert<VALUE : Any>(option: Option<VALUE>?) :
1213
AbstractOptionAssert<OptionAssert<VALUE>, VALUE>(option) {

src/main/kotlin/in/rcard/assertj/arrowcore/RaiseAssert.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ class RaiseAssert<ERROR : Any, VALUE : Any> private constructor(lambda: Raise<ER
2727
): RaiseAssert<ERROR, VALUE> =
2828
RaiseAssert(lambda)
2929

30+
/**
31+
* Verifies that the function in the [Raise] context throws an exception.
32+
* @param shouldRaiseThrowable the function to be executed in the [Raise] context.
33+
* @return the [AbstractThrowableAssert] to be used to verify the exception.
34+
*/
3035
fun <ERROR : Any, VALUE : Any> assertThatThrownBy(
3136
@BuilderInference shouldRaiseThrowable: Raise<ERROR>.() -> VALUE
3237
): AbstractThrowableAssert<*, out Throwable> {

src/main/kotlin/in/rcard/assertj/arrowcore/errors/EitherShouldBeLeft.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.assertj.core.error.BasicErrorMessageFactory
77
* Build error message when an [Either] should be left.
88
*
99
* @author Riccardo Cardin
10+
* @since 0.0.1
1011
*/
1112
internal class EitherShouldBeLeft(actual: Either<*, *>) :
1213
BasicErrorMessageFactory("%nExpecting an Either to be left but was <$actual>.") {

src/main/kotlin/in/rcard/assertj/arrowcore/errors/EitherShouldBeRight.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.assertj.core.error.BasicErrorMessageFactory
77
* Build error message when an [Either] should be right.
88
*
99
* @author Riccardo Cardin
10+
* @since 0.0.1
1011
*/
1112
internal class EitherShouldBeRight(actual: Either<*, *>) :
1213
BasicErrorMessageFactory("%nExpecting an Either to be right but was <$actual>.") {

src/main/kotlin/in/rcard/assertj/arrowcore/errors/EitherShouldContain.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import org.assertj.core.error.BasicErrorMessageFactory
77
* Build error message when an [Either] should contain a specific value.
88
*
99
* @author Riccardo Cardin
10+
* @since 0.0.1
1011
*/
1112
internal class EitherShouldContain(message: String, actual: Either<Any, Any>, expected: Any) :
1213
BasicErrorMessageFactory(message, actual, expected) {

src/main/kotlin/in/rcard/assertj/arrowcore/errors/EitherShouldContainInstanceOf.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.assertj.core.error.BasicErrorMessageFactory
88
* class.
99
*
1010
* @author Riccardo Cardin
11+
* @since 0.0.1
1112
*/
1213
internal class EitherShouldContainInstanceOf(message: String) : BasicErrorMessageFactory(message) {
1314
companion object {

0 commit comments

Comments
 (0)