Skip to content

Commit

Permalink
Unify all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
osoykan committed Oct 29, 2024
1 parent f170f10 commit 7c4a58c
Show file tree
Hide file tree
Showing 28 changed files with 791 additions and 946 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ jobs:
name: codecov-umbrella
fail_ci_if_error: false
verbose: true
java-version: 17
token: ${{ secrets.CODECOV_TOKEN }}
if: github.ref == 'refs/heads/main'
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- "**/testFixtures/**"
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ abstract class Registrar {
protected fun extractParameter(genericInterface: ParameterizedType): Class<*> =
when (val typeArgument = genericInterface.actualTypeArguments[0]) {
is ParameterizedType -> typeArgument.rawType as Class<*>
is TypeVariable<*> -> extractParameter((genericInterface.rawType as Class<*>).genericInterfaces[0] as ParameterizedType)
is TypeVariable<*> -> {
val rawType = (genericInterface.rawType as Class<*>)
when {
rawType.genericInterfaces.any() -> extractParameter(rawType.genericInterfaces[0] as ParameterizedType)
else -> rawType
}
}

else -> typeArgument as Class<*>
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.trendyol.kediatr

import com.trendyol.kediatr.testing.*
import io.kotest.matchers.shouldBe
import org.junit.jupiter.api.Test

class MediatorTests : MediatorUseCases() {
override fun provideMediator(): Mediator = createMediator(
types = listOf(
TestCommandHandler(mediator = { testMediator }),
TestPipelineCommandHandler(mediator = { testMediator }),
TestCommandWithResultCommandHandler(mediator = { testMediator }),
TestNotificationHandler(mediator = { testMediator }),
TestQueryHandler(mediator = { testMediator }),
TestCommandHandlerWithoutInjection(),
TestInheritedCommandHandlerForSpecificCommand(),
TestCommandHandlerForTypeLimitedInheritance(),
ParameterizedCommandHandler<String>(),
ParameterizedCommandHandlerForInheritance<String>(),
ParameterizedCommandWithResultHandler<Long, String>(),
ParameterizedCommandWithResultHandlerOfInheritedHandler<String>(),
APingHandler(),
AnotherPingHandler(),
Handler1ForNotificationOfMultipleHandlers(),
Handler2ForNotificationOfMultipleHandlers(),
InheritedNotificationHandler(),
ParameterizedNotificationHandler<String>(),
ParameterizedNotificationHandlerForInheritance<String>(),
TestPipelineCommandHandlerWithoutInjection(),
TestPipelineCommandHandlerThatFails(),
ExceptionPipelineBehavior(),
LoggingPipelineBehavior(),
InheritedPipelineBehaviour(),
ParameterizedQueryHandler<Long, String>()
)
)

@Test
fun `when a publish strategy is defined it should be set`() {
listOf(
ContinueOnExceptionPublishStrategy(),
ParallelNoWaitPublishStrategy(),
ParallelWhenAllPublishStrategy(),
StopOnExceptionPublishStrategy()
).forEach {
val builder = MediatorBuilder(MappingDependencyProvider(hashMapOf())).withPublishStrategy(it)
builder.defaultPublishStrategy shouldBe it
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 7c4a58c

Please sign in to comment.