|
3 | 3 |
|
4 | 4 | package software.aws.toolkits.jetbrains.core.notifications |
5 | 5 |
|
| 6 | +import com.intellij.testFramework.ApplicationExtension |
| 7 | +import com.intellij.testFramework.ProjectRule |
6 | 8 | import org.assertj.core.api.Assertions.assertThat |
| 9 | +import org.junit.Rule |
7 | 10 | import org.junit.jupiter.api.Test |
| 11 | +import org.junit.jupiter.api.extension.ExtendWith |
8 | 12 |
|
| 13 | +@ExtendWith(ApplicationExtension::class) |
9 | 14 | class NotificationManagerTest { |
| 15 | + @Rule |
| 16 | + @JvmField |
| 17 | + val projectRule = ProjectRule() |
10 | 18 |
|
11 | 19 | @Test |
12 | 20 | fun `If no follow-up actions, expand action is present`() { |
13 | | - val sut = NotificationManager.createActions(null, "Dummy Test Action", "Dummy title") |
| 21 | + val sut = NotificationManager.createActions(projectRule.project, listOf(), "Dummy Test Action", "Dummy title") |
14 | 22 | assertThat(sut).isNotNull |
15 | 23 | assertThat(sut).hasSize(1) |
16 | | - assertThat(sut.first().title).isEqualTo("Expand") |
| 24 | + assertThat(sut.first().title).isEqualTo("More...") |
17 | 25 | } |
18 | 26 |
|
19 | 27 | @Test |
20 | 28 | fun `Show Url action shows the option to learn more`() { |
21 | 29 | val followupActions = NotificationFollowupActions( |
22 | | - "ShowUrl", |
23 | | - NotificationFollowupActionsContent(NotificationActionDescription("title", "http://leadsnowhere")) |
| 30 | + "UpdateExtension", |
| 31 | + NotificationFollowupActionsContent(NotificationActionDescription("title", null)) |
24 | 32 | ) |
25 | | - val sut = NotificationManager.createActions(listOf(followupActions), "Dummy Test Action", "Dummy title") |
| 33 | + val sut = NotificationManager.createActions(projectRule.project,listOf(followupActions), "Dummy Test Action", "Dummy title") |
26 | 34 | assertThat(sut).isNotNull |
27 | 35 | assertThat(sut).hasSize(2) |
28 | | - assertThat(sut.first().title).isEqualTo("Expand") |
29 | | - assertThat(sut[1].title).isEqualTo("Learn more") |
| 36 | + assertThat(sut.first().title).isEqualTo("Update") |
| 37 | + assertThat(sut[1].title).isEqualTo("More...") |
30 | 38 | } |
31 | 39 | } |
0 commit comments