Skip to content

Commit 497dab8

Browse files
committed
spotless
1 parent e266e1f commit 497dab8

File tree

14 files changed

+25
-17
lines changed

14 files changed

+25
-17
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ktlint_standard_function-signature = disabled
1212
[{*.kt,*.kts}]
1313
indent_style = space
1414
max_line_length = 140
15+
indent_size = 2
1516
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
1617
ij_continuation_indent_size = 2
1718
ij_kotlin_allow_trailing_comma = false

build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
java
66
id("kediatr-publishing") apply false
77
alias(libs.plugins.gitVersion)
8+
alias(libs.plugins.spotless)
89
}
910

1011
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
@@ -16,6 +17,14 @@ subprojectsOf("projects") {
1617
plugin("kotlin")
1718
plugin("kediatr-publishing")
1819
plugin("java")
20+
plugin(rootProject.libs.plugins.spotless.pluginId)
21+
}
22+
23+
spotless {
24+
kotlin {
25+
ktlint()
26+
.setEditorConfigPath(rootProject.layout.projectDirectory.file(".editorconfig"))
27+
}
1928
}
2029

2130
java {

projects/kediatr-core/src/test/kotlin/com/trendyol/kediatr/CommandHandlerTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ package com.trendyol.kediatr
33
import com.trendyol.kediatr.coreUseCases.CommandHandlerUseCases
44

55
class CommandHandlerTest : CommandHandlerUseCases()
6-

projects/kediatr-core/src/testFixtures/kotlin/com/trendyol/kediatr/coreUseCases/CommandHandlerUseCases.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ abstract class CommandHandlerUseCases : MediatorTestConvention() {
1515
var invocationCount = 0
1616

1717
class MyAsyncCommand : Command
18+
1819
class MyCommandHandler : CommandHandler<MyAsyncCommand> {
1920
override suspend fun handle(command: MyAsyncCommand) {
2021
invocationCount++
@@ -45,7 +46,9 @@ abstract class CommandHandlerUseCases : MediatorTestConvention() {
4546
var invocationCount = 0
4647

4748
class MyCommandForInheritance : Command
49+
4850
abstract class MyCommandHandlerFor<TCommand : Command> : CommandHandler<TCommand>
51+
4952
class MyInheritedCommandHandler : MyCommandHandlerFor<MyCommandForInheritance>() {
5053
override suspend fun handle(command: MyCommandForInheritance) {
5154
invocationCount++
@@ -64,7 +67,9 @@ abstract class CommandHandlerUseCases : MediatorTestConvention() {
6467
var invocationCount = 0
6568

6669
class MyCommandForInheritance : Command
70+
6771
abstract class MyCommandHandlerBaseForSpecificCommand : CommandHandler<MyCommandForInheritance>
72+
6873
class MyInheritedCommandHandlerForSpecificCommand : MyCommandHandlerBaseForSpecificCommand() {
6974
override suspend fun handle(command: MyCommandForInheritance) {
7075
invocationCount++
@@ -83,6 +88,7 @@ abstract class CommandHandlerUseCases : MediatorTestConvention() {
8388
var invocationCount = 0
8489

8590
class ParameterizedCommand<T>(val param: T) : Command
91+
8692
class ParameterizedCommandHandler<A> : CommandHandler<ParameterizedCommand<A>> {
8793
override suspend fun handle(command: ParameterizedCommand<A>) {
8894
command.param shouldBe "MyParam"
@@ -106,7 +112,9 @@ abstract class CommandHandlerUseCases : MediatorTestConvention() {
106112
var invocationCount = 0
107113

108114
class ParameterizedCommand<T>(val param: T) : Command
115+
109116
abstract class ParameterizedCommandHandlerBase<A> : CommandHandler<ParameterizedCommand<A>>
117+
110118
class ParameterizedCommandHandler<A> : ParameterizedCommandHandlerBase<A>() {
111119
override suspend fun handle(command: ParameterizedCommand<A>) {
112120
command.param shouldBe "MyParam"
@@ -125,4 +133,3 @@ abstract class CommandHandlerUseCases : MediatorTestConvention() {
125133
invocationCount shouldBe 1
126134
}
127135
}
128-

projects/kediatr-core/src/testFixtures/kotlin/com/trendyol/kediatr/coreUseCases/CommandWithResultHandlerUseCases.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ private var counter = 0
1111
private var asyncTestCounter = 0
1212

1313
abstract class CommandWithResultHandlerUseCases : MediatorTestConvention() {
14-
1514
@BeforeEach
1615
fun beforeEach() {
1716
counter = 0
@@ -41,6 +40,7 @@ abstract class CommandWithResultHandlerUseCases : MediatorTestConvention() {
4140
var invocationCount = 0
4241

4342
class MyAsyncCommand : CommandWithResult<Result>
43+
4444
class AsyncMyCommandHandler : CommandWithResultHandler<MyAsyncCommand, Result> {
4545
override suspend fun handle(command: MyAsyncCommand): Result {
4646
invocationCount++

projects/kediatr-core/src/testFixtures/kotlin/com/trendyol/kediatr/coreUseCases/NotificationHandlerUseCases.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import java.util.concurrent.CountDownLatch
1111
private var asyncCountDownLatch = CountDownLatch(1)
1212

1313
abstract class NotificationHandlerUseCases : MediatorTestConvention() {
14-
1514
@BeforeEach
1615
fun beforeEach() {
1716
asyncCountDownLatch = CountDownLatch(1)
@@ -53,7 +52,9 @@ abstract class NotificationHandlerUseCases : MediatorTestConvention() {
5352
@Test
5453
fun inherited_notification_handler_should_be_called() = runTest {
5554
class PingForInherited : Notification
55+
5656
abstract class NotificationHandlerBase<TNotification : Notification> : NotificationHandler<TNotification>
57+
5758
class InheritedNotificationHandler : NotificationHandlerBase<PingForInherited>() {
5859
override suspend fun handle(notification: PingForInherited) {
5960
asyncCountDownLatch.countDown()
@@ -67,6 +68,7 @@ abstract class NotificationHandlerUseCases : MediatorTestConvention() {
6768
}
6869

6970
inner class ParameterizedNotification<T>(val param: T) : Notification
71+
7072
inner class ParameterizedNotificationHandler<A> : NotificationHandler<ParameterizedNotification<A>> {
7173
override suspend fun handle(notification: ParameterizedNotification<A>) {
7274
notification.param shouldBe "MyParam"

projects/kediatr-core/src/testFixtures/kotlin/com/trendyol/kediatr/coreUseCases/PublishStrategyTests.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import io.kotest.matchers.shouldBe
55
import org.junit.jupiter.api.Test
66

77
class PublishStrategyTests {
8-
98
@Test
109
fun `When a publish strategy is defined it should be set`() {
1110
listOf(

projects/kediatr-core/src/testFixtures/kotlin/com/trendyol/kediatr/coreUseCases/QueryHandlerUseCases.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,4 @@ abstract class QueryHandlerUseCases : MediatorTestConvention() {
5959
// then
6060
result shouldBe "61"
6161
}
62-
6362
}

projects/kediatr-core/src/testFixtures/kotlin/com/trendyol/kediatr/coreUseCases/convention.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ import com.trendyol.kediatr.MediatorBuilder
55

66
@Suppress("UNCHECKED_CAST")
77
abstract class MediatorTestConvention {
8-
98
protected fun newMediator(handlers: List<Any> = emptyList()): Mediator = createMediator(handlers)
109

1110
private fun createMediator(
12-
handlers: List<Any> = emptyList(),
11+
handlers: List<Any> = emptyList()
1312
): Mediator {
1413
val provider = MappingDependencyProvider(handlers.associateBy { it.javaClass } as HashMap<Class<*>, Any>)
1514
return MediatorBuilder(provider).build()
1615
}
1716
}
18-

projects/kediatr-core/src/testFixtures/kotlin/com/trendyol/kediatr/framewokUseCases/MediatorUseCases.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import kotlinx.coroutines.test.runTest
77
import org.junit.jupiter.api.*
88

99
abstract class MediatorUseCases : MediatorDIConvention {
10-
1110
@Test
1211
fun command() = runTest {
1312
val count = 0
@@ -60,7 +59,6 @@ abstract class MediatorUseCases : MediatorDIConvention {
6059
fun `should throw exception if given async query does not have handler bean`() = runTest {
6160
val exception = shouldThrow<HandlerNotFoundException> {
6261
testMediator.send(NonExistQuery())
63-
6462
}
6563

6664
exception.message shouldBe "handler could not be found for ${NonExistQuery::class.java.typeName}"

0 commit comments

Comments
 (0)