All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmTest.utility.Startable.kt Maven / Gradle / Ivy

There is a newer version: 0.27.0
Show newest version
package tests

import io.fluidsonic.raptor.*
import kotlinx.coroutines.*


class Startable(
	private val delayInMilliseconds: Long
) {

	var isStarted = false
		private set


	suspend fun start() {
		check(!isStarted) { "Already started." }

		isStarted = true

		delay(delayInMilliseconds)
	}


	suspend fun stop() {
		check(isStarted) { "Not started." }

		isStarted = false

		delay(delayInMilliseconds)
	}


	companion object {

		val propertyKey = RaptorPropertyKey("startable")
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy