Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import org.assertj.core.internal.StandardComparisonStrategy
*/
abstract class AbstractRaiseAssert<
SELF : AbstractRaiseAssert<SELF, ERROR, VALUE>,
ERROR : Any,
VALUE : Any,
ERROR : Any?,
VALUE : Any?,
> internal constructor(
raiseResult: RaiseResult<ERROR, VALUE>,
) : AbstractAssert<
Expand Down Expand Up @@ -155,12 +155,12 @@ abstract class AbstractRaiseAssert<
}
}

sealed interface RaiseResult<out ERROR : Any, out VALUE : Any> {
data class Success<out VALUE : Any>(
sealed interface RaiseResult<out ERROR : Any?, out VALUE : Any?> {
data class Success<out VALUE : Any?>(
val value: VALUE,
) : RaiseResult<Nothing, VALUE>

data class Failure<out ERROR : Any>(
data class Failure<out ERROR : Any?>(
val error: ERROR,
) : RaiseResult<ERROR, Nothing>

Expand Down
8 changes: 4 additions & 4 deletions src/main/kotlin/in/rcard/assertj/arrowcore/RaiseAssert.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import kotlin.experimental.ExperimentalTypeInference
*
* @since 0.2.0
*/
class RaiseAssert<ERROR : Any, VALUE : Any>(
class RaiseAssert<ERROR : Any?, VALUE : Any?>(
raiseResult: RaiseResult<ERROR, VALUE>,
) : AbstractRaiseAssert<RaiseAssert<ERROR, VALUE>, ERROR, VALUE>(raiseResult) {
companion object {
inline fun <ERROR : Any, VALUE : Any> assertThat(
inline fun <ERROR : Any?, VALUE : Any?> assertThat(
@BuilderInference lambda: Raise<ERROR>.() -> VALUE,
): RaiseAssert<ERROR, VALUE> {
val raiseResult =
Expand Down Expand Up @@ -54,7 +54,7 @@ class RaiseAssert<ERROR : Any, VALUE : Any>(
* @param shouldRaiseThrowable the function to be executed in the [Raise] context.
* @return the [AbstractThrowableAssert] to be used to verify the exception.
*/
inline fun <ERROR : Any, VALUE : Any> assertThatThrownBy(
inline fun <ERROR : Any?, VALUE : Any?> assertThatThrownBy(
@BuilderInference shouldRaiseThrowable: Raise<ERROR>.() -> VALUE,
): AbstractThrowableAssert<*, out Throwable> {
val throwable: Throwable? =
Expand All @@ -81,7 +81,7 @@ class RaiseAssert<ERROR : Any, VALUE : Any>(
* @param shouldRaiseError the function to be executed in the [Raise] context.
* @return the [AbstractObjectAssert] to be used to verify the error.
*/
inline fun <ERROR : Any, VALUE : Any> assertThatRaisedBy(
inline fun <ERROR : Any?, VALUE : Any?> assertThatRaisedBy(
@BuilderInference shouldRaiseError: Raise<ERROR>.() -> VALUE,
): AbstractObjectAssert<*, out ERROR> {
val error =
Expand Down