File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
jetbrains-core/tst/software/aws/toolkits/jetbrains/core/credentials Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ import software.aws.toolkits.core.utils.test.aString
15
15
import software.aws.toolkits.jetbrains.core.AwsResourceCacheTest.Companion.dummyResource
16
16
import software.aws.toolkits.jetbrains.core.MockResourceCacheRule
17
17
import java.util.concurrent.ConcurrentHashMap
18
+ import java.util.concurrent.CountDownLatch
19
+ import java.util.concurrent.TimeUnit
18
20
19
21
class RefreshConnectionActionTest {
20
22
@Rule
@@ -31,19 +33,23 @@ class RefreshConnectionActionTest {
31
33
fun refreshActionClearsCacheAndUpdatesConnectionState () {
32
34
resourceCache.addEntry(projectRule.project, dummyResource(), aString())
33
35
36
+ val latch = CountDownLatch (1 )
34
37
val states = ConcurrentHashMap .newKeySet<ConnectionState >()
35
38
projectRule.project.messageBus.connect()
36
39
.subscribe(
37
40
AwsConnectionManager .CONNECTION_SETTINGS_STATE_CHANGED ,
38
41
object : ConnectionSettingsStateChangeNotifier {
39
42
override fun settingsStateChanged (newState : ConnectionState ) {
40
43
states.add(newState)
44
+ latch.countDown()
41
45
}
42
46
}
43
47
)
44
48
45
49
sut.actionPerformed(testAction())
46
50
51
+ assertThat(latch.await(5 , TimeUnit .SECONDS )).isTrue
52
+
47
53
assertThat(resourceCache.size()).isZero()
48
54
assertThat(states).hasAtLeastOneElementOfType(ConnectionState .ValidatingConnection ::class .java)
49
55
}
You can’t perform that action at this time.
0 commit comments