Fix kotlin code style issues

This commit is contained in:
Gary Tierney
2018-09-04 04:43:34 +01:00
parent b6086d57b8
commit 475c7ac741
89 changed files with 338 additions and 435 deletions
@@ -4,7 +4,6 @@ import io.mockk.MockKVerificationScope
import io.mockk.verify
import org.apollo.game.plugin.testing.junit.api.ActionCaptureCallbackRegistration
/**
* Verify some expectations on a [mock] after a delayed event (specified by [DelayMode]).
*/
@@ -3,6 +3,7 @@ package org.apollo.game.plugin.testing.junit
import io.mockk.every
import io.mockk.slot
import io.mockk.spyk
import kotlin.reflect.KClass
import org.apollo.game.action.Action
import org.apollo.game.message.handler.MessageHandlerChainSet
import org.apollo.game.model.World
@@ -12,7 +13,6 @@ import org.apollo.game.plugin.testing.junit.mocking.StubPrototype
import org.apollo.game.plugin.testing.junit.stubs.PlayerStubInfo
import org.apollo.net.message.Message
import org.apollo.util.security.PlayerCredentials
import kotlin.reflect.KClass
data class ApolloTestState(val handlers: MessageHandlerChainSet, val world: World) {
val players = mutableListOf<Player>()
@@ -4,6 +4,14 @@ import io.mockk.every
import io.mockk.slot
import io.mockk.spyk
import io.mockk.staticMockk
import kotlin.reflect.KCallable
import kotlin.reflect.KMutableProperty
import kotlin.reflect.full.companionObject
import kotlin.reflect.full.createType
import kotlin.reflect.full.declaredMemberFunctions
import kotlin.reflect.full.declaredMemberProperties
import kotlin.reflect.jvm.isAccessible
import kotlin.reflect.jvm.jvmErasure
import org.apollo.cache.def.ItemDefinition
import org.apollo.cache.def.NpcDefinition
import org.apollo.cache.def.ObjectDefinition
@@ -20,22 +28,6 @@ import org.apollo.game.plugin.testing.junit.api.annotations.NpcDefinitions
import org.apollo.game.plugin.testing.junit.api.annotations.ObjectDefinitions
import org.apollo.game.plugin.testing.junit.mocking.StubPrototype
import org.junit.jupiter.api.extension.*
import kotlin.reflect.KCallable
import kotlin.reflect.KMutableProperty
import kotlin.reflect.full.companionObject
import kotlin.reflect.full.createType
import kotlin.reflect.full.declaredMemberFunctions
import kotlin.reflect.full.declaredMemberProperties
import kotlin.reflect.jvm.isAccessible
import kotlin.reflect.jvm.jvmErasure
internal val supportedTestDoubleTypes = setOf(
Player::class.createType(),
Npc::class.createType(),
GameObject::class.createType(),
World::class.createType(),
ActionCapture::class.createType()
)
class ApolloTestingExtension :
AfterTestExecutionCallback,
@@ -168,6 +160,13 @@ class ApolloTestingExtension :
}
companion object {
internal val supportedTestDoubleTypes = setOf(
Player::class.createType(),
Npc::class.createType(),
GameObject::class.createType(),
World::class.createType(),
ActionCapture::class.createType()
)
inline fun <reified D : Any, reified A : Annotation> findTestDefinitions(
callables: Collection<KCallable<*>>,
@@ -185,7 +184,5 @@ class ApolloTestingExtension :
method.call(companionObjectInstance)
}
}
}
}
@@ -1,10 +1,10 @@
package org.apollo.game.plugin.testing.junit.api
import kotlin.reflect.KClass
import kotlin.reflect.full.isSuperclassOf
import org.apollo.game.action.Action
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import kotlin.reflect.KClass
import kotlin.reflect.full.isSuperclassOf
class ActionCapture(val type: KClass<out Action<*>>) {
private var action: Action<*>? = null
@@ -62,7 +62,6 @@ class ActionCapture(val type: KClass<out Action<*>>) {
})
}
/**
* Create a callback registration that triggers after exactly [count] ticks.
*/
@@ -1,6 +0,0 @@
package org.apollo.game.plugin.testing.junit.api.annotations
import org.apollo.game.action.Action
import kotlin.reflect.KClass
annotation class ActionTest(val value: KClass<out Action<*>> = Action::class)
@@ -18,7 +18,6 @@ fun World.spawnObject(id: Int, position: Position): GameObject {
return obj
}
/**
* Spawns a new NPC with the minimum set of dependencies required to function correctly in the world.
*/
@@ -1,5 +1,10 @@
package org.apollo.game.plugin.testing.junit.params
import java.util.stream.Stream
import kotlin.reflect.KCallable
import kotlin.reflect.full.companionObject
import kotlin.reflect.full.declaredMemberFunctions
import kotlin.reflect.full.declaredMemberProperties
import org.apollo.cache.def.ItemDefinition
import org.apollo.cache.def.NpcDefinition
import org.apollo.cache.def.ObjectDefinition
@@ -11,11 +16,6 @@ import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.ArgumentsProvider
import org.junit.jupiter.params.support.AnnotationConsumer
import java.util.stream.Stream
import kotlin.reflect.KCallable
import kotlin.reflect.full.companionObject
import kotlin.reflect.full.declaredMemberFunctions
import kotlin.reflect.full.declaredMemberProperties
/**
* An [ArgumentsProvider] for a definition of type `D`.
@@ -64,7 +64,6 @@ object ItemDefinitionsProvider : DefinitionsProvider<ItemDefinition>(
override fun accept(source: ItemDefinitionSource) {
sourceNames = source.sourceNames.toHashSet()
}
}
/**
@@ -80,7 +79,6 @@ object NpcDefinitionsProvider : DefinitionsProvider<NpcDefinition>(
override fun accept(source: NpcDefinitionSource) {
sourceNames = source.sourceNames.toHashSet()
}
}
/**
@@ -96,5 +94,4 @@ object ObjectDefinitionsProvider : DefinitionsProvider<ObjectDefinition>(
override fun accept(source: ObjectDefinitionSource) {
sourceNames = source.sourceNames.toHashSet()
}
}
@@ -1,2 +1 @@
package org.apollo.game.plugin.testing.junit.stubs
@@ -1,2 +1 @@
package org.apollo.game.plugin.testing.junit.stubs
@@ -18,10 +18,8 @@ class PlayerStubInfo {
return info
}
}
var position = Position(3222, 3222)
var name = "test"
}