Skip to content

Instantly share code, notes, and snippets.

@jaimedantas
Created April 1, 2021 00:05
Show Gist options
  • Save jaimedantas/183b895eaa8513e2e14e88ce38001b17 to your computer and use it in GitHub Desktop.
Save jaimedantas/183b895eaa8513e2e14e88ce38001b17 to your computer and use it in GitHub Desktop.
@MicronautTest(propertySources = ["application.yml"])
@Property(name = "microservice.threads", value = "1")
class LoadSimulatorTest{
@Inject
lateinit var loadSimulator: LoadSimulator
@Test
@Property(name = "microservice.processingTime", value = "1000")
fun shouldTakeTimeDefinedForProcessing() = runBlocking<Unit> {
val message = "Hello World!"
val time = 1000
val startedTime = LocalDateTime.now()
val result = loadSimulator.processLoad()
val finishedTime = LocalDateTime.now()
val validationResult = ChronoUnit.MILLIS.between(startedTime,finishedTime) >= time
assertTrue(validationResult)
assertEquals(message, result.message)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment