mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 08:39:27 +00:00
Fix kotlin code style issues
This commit is contained in:
-1
@@ -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]).
|
||||
*/
|
||||
|
||||
+1
-1
@@ -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>()
|
||||
|
||||
+15
-18
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+2
-3
@@ -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.
|
||||
*/
|
||||
|
||||
-6
@@ -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)
|
||||
-1
@@ -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.
|
||||
*/
|
||||
|
||||
+5
-8
@@ -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
@@ -1,2 +1 @@
|
||||
package org.apollo.game.plugin.testing.junit.stubs
|
||||
|
||||
|
||||
-1
@@ -1,2 +1 @@
|
||||
package org.apollo.game.plugin.testing.junit.stubs
|
||||
|
||||
|
||||
-2
@@ -18,10 +18,8 @@ class PlayerStubInfo {
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var position = Position(3222, 3222)
|
||||
var name = "test"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user