Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -49,8 +49,9 @@ class ScheduledAnnotationReactiveSupportTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
// Note: monoWithParams can't be found by this test.
|
||||
@ValueSource(strings = { "mono", "flux", "monoString", "fluxString", "publisherMono",
|
||||
"publisherString", "monoThrows", "flowable", "completable" }) //note: monoWithParams can't be found by this test
|
||||
"publisherString", "monoThrows", "flowable", "completable" })
|
||||
void checkIsReactive(String method) {
|
||||
Method m = ReflectionUtils.findMethod(ReactiveMethods.class, method);
|
||||
assertThat(isReactive(m)).as(m.getName()).isTrue();
|
||||
@@ -60,8 +61,7 @@ class ScheduledAnnotationReactiveSupportTests {
|
||||
void checkNotReactive() {
|
||||
Method string = ReflectionUtils.findMethod(ReactiveMethods.class, "oops");
|
||||
|
||||
assertThat(isReactive(string))
|
||||
.as("String-returning").isFalse();
|
||||
assertThat(isReactive(string)).as("String-returning").isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -235,4 +235,5 @@ class ScheduledAnnotationReactiveSupportTests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import org.assertj.core.api.Assertions
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.params.ParameterizedTest
|
||||
import org.junit.jupiter.params.provider.ValueSource
|
||||
@@ -35,6 +34,9 @@ import kotlin.coroutines.Continuation
|
||||
|
||||
class KotlinScheduledAnnotationReactiveSupportTests {
|
||||
|
||||
private var target: SuspendingFunctions? = SuspendingFunctions()
|
||||
|
||||
|
||||
@Test
|
||||
fun ensureReactor() {
|
||||
assertThat(ScheduledAnnotationReactiveSupport.reactorPresent).isTrue
|
||||
@@ -65,44 +67,6 @@ class KotlinScheduledAnnotationReactiveSupportTests {
|
||||
assertThat(isReactive(method)).isFalse
|
||||
}
|
||||
|
||||
internal class SuspendingFunctions {
|
||||
suspend fun suspending() {
|
||||
}
|
||||
|
||||
suspend fun suspendingReturns(): String = "suspended"
|
||||
|
||||
suspend fun withParam(param: String): String {
|
||||
return param
|
||||
}
|
||||
|
||||
suspend fun throwsIllegalState() {
|
||||
throw IllegalStateException("expected")
|
||||
}
|
||||
|
||||
var subscription = AtomicInteger()
|
||||
suspend fun suspendingTracking() {
|
||||
subscription.incrementAndGet()
|
||||
}
|
||||
|
||||
fun notSuspending() { }
|
||||
|
||||
fun flow(): Flow<Void> {
|
||||
return flowOf()
|
||||
}
|
||||
|
||||
fun deferred(): Deferred<Void> {
|
||||
return CompletableDeferred()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private var target: SuspendingFunctions? = null
|
||||
|
||||
@BeforeEach
|
||||
fun init() {
|
||||
target = SuspendingFunctions()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun checkKotlinRuntimeIfNeeded() {
|
||||
val suspendingMethod = ReflectionUtils.findMethod(SuspendingFunctions::class.java, "suspending", Continuation::class.java)!!
|
||||
@@ -152,4 +116,36 @@ class KotlinScheduledAnnotationReactiveSupportTests {
|
||||
mono.block()
|
||||
assertThat(target!!.subscription).describedAs("after subscription").hasValue(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal class SuspendingFunctions {
|
||||
suspend fun suspending() {
|
||||
}
|
||||
|
||||
suspend fun suspendingReturns(): String = "suspended"
|
||||
|
||||
suspend fun withParam(param: String): String {
|
||||
return param
|
||||
}
|
||||
|
||||
suspend fun throwsIllegalState() {
|
||||
throw IllegalStateException("expected")
|
||||
}
|
||||
|
||||
var subscription = AtomicInteger()
|
||||
suspend fun suspendingTracking() {
|
||||
subscription.incrementAndGet()
|
||||
}
|
||||
|
||||
fun notSuspending() { }
|
||||
|
||||
fun flow(): Flow<Void> {
|
||||
return flowOf()
|
||||
}
|
||||
|
||||
fun deferred(): Deferred<Void> {
|
||||
return CompletableDeferred()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user