-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add missing groovy tests (#9000)
- Loading branch information
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...-groovy/src/test/groovy/io/micronaut/docs/expressions/AnnotationContextExampleSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.micronaut.docs.expressions | ||
|
||
import io.micronaut.context.BeanContext | ||
import io.micronaut.inject.BeanDefinition | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
class AnnotationContextExampleSpec extends Specification { | ||
@Shared | ||
@AutoCleanup | ||
BeanContext beanContext = BeanContext.run() | ||
void "testAnnotationContextEvaluation"() { | ||
given: | ||
BeanDefinition<Example> beanDefinition = beanContext.getBeanDefinition(Example) | ||
String val = beanDefinition.stringValue(CustomAnnotation).orElse(null) | ||
|
||
expect: | ||
"first valuesecond value" == val | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
test-suite-groovy/src/test/groovy/io/micronaut/docs/expressions/ExampleJobSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package io.micronaut.docs.expressions | ||
|
||
import io.micronaut.context.ApplicationContext | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared; | ||
import spock.lang.Specification | ||
|
||
import static java.util.concurrent.TimeUnit.SECONDS | ||
import static org.awaitility.Awaitility.await | ||
|
||
class ExampleJobSpec extends Specification { | ||
@Shared | ||
@AutoCleanup | ||
ApplicationContext ctx = ApplicationContext.run() | ||
|
||
void testJobCondition(){ | ||
given: | ||
ExampleJob exampleJob = ctx.getBean(ExampleJob) | ||
ExampleJobControl jobControl = ctx.getBean(ExampleJobControl) | ||
|
||
expect: | ||
jobControl.isPaused() | ||
!exampleJob.hasJobRun() | ||
|
||
when: | ||
Thread.sleep(5000) | ||
|
||
then: | ||
!exampleJob.hasJobRun() | ||
|
||
when: | ||
jobControl.unpause() | ||
|
||
then: | ||
await().atMost(3, SECONDS).until(exampleJob::hasJobRun) | ||
|
||
and: | ||
exampleJob.hasJobRun() | ||
} | ||
} |