1 /* 2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.coroutines.debug.junit5 6 7 import kotlinx.coroutines.* 8 import org.junit.jupiter.api.* 9 10 /** 11 * Tests usage of [CoroutinesTimeout] on classes and test methods when only methods are annotated. 12 * 13 * This test class is not intended to be run manually. Instead, use [CoroutinesTimeoutTest] as the entry point. 14 */ 15 @TestMethodOrder(MethodOrderer.OrderAnnotation::class) 16 class CoroutinesTimeoutMethodTest { 17 18 @Test 19 @Order(1) noClassTimeoutnull20 fun noClassTimeout() { 21 runBlocking { 22 delay(150) 23 } 24 } 25 26 @CoroutinesTimeout(100) 27 @Test 28 @Order(2) usesMethodTimeoutWithNoClassTimeoutnull29 fun usesMethodTimeoutWithNoClassTimeout() { 30 runBlocking { 31 delay(1000) 32 } 33 } 34 35 @CoroutinesTimeout(1000) 36 @Test 37 @Order(3) fitsInMethodTimeoutnull38 fun fitsInMethodTimeout() { 39 runBlocking { 40 delay(10) 41 } 42 } 43 44 } 45