25
25
package com.bakdata.gradle
26
26
27
27
import com.bakdata.gradle.ReleasePlugin.Companion.DISABLE_PUSH_TO_REMOTE
28
+ import com.bakdata.gradle.ReleasePlugin.Companion.FUTURE_VERSION_TAG
29
+ import com.bakdata.gradle.ReleasePlugin.Companion.GITHUB_REPOSITORY
28
30
import com.bakdata.gradle.ReleasePlugin.Companion.REQUIRE_BRANCH
31
+ import com.bakdata.gradle.ReleasePlugin.Companion.SINCE_TAG
29
32
import net.researchgate.release.ReleaseExtension
30
33
import net.researchgate.release.ReleasePlugin
31
34
import org.assertj.core.api.Assertions.assertThat
@@ -37,6 +40,8 @@ import org.gradle.api.internal.project.DefaultProject
37
40
import org.gradle.kotlin.dsl.extra
38
41
import org.gradle.kotlin.dsl.findByType
39
42
import org.gradle.testfixtures.ProjectBuilder
43
+ import org.hildan.github.changelog.plugin.GitHubChangelogExtension
44
+ import org.hildan.github.changelog.plugin.GitHubChangelogPlugin
40
45
import org.junit.jupiter.api.Test
41
46
42
47
internal class ReleasePluginTest {
@@ -57,11 +62,18 @@ internal class ReleasePluginTest {
57
62
SoftAssertions .assertSoftly { softly ->
58
63
softly.assertThat(project.plugins)
59
64
.haveExactly(1 , Condition ({ it is ReleasePlugin }, " Has release plugin" ))
65
+ .haveExactly(1 , Condition ({ it is GitHubChangelogPlugin }, " Has changelog plugin" ))
60
66
softly.assertThat(project.extensions.findByType<ReleaseExtension >()?.git)
61
67
.satisfies {
62
68
softly.assertThat(it?.pushToRemote?.get()).isEqualTo(" origin" )
63
69
softly.assertThat(it?.requireBranch?.get()).isEqualTo(" main" )
64
70
}
71
+ softly.assertThat(project.extensions.findByType<GitHubChangelogExtension >())
72
+ .satisfies {
73
+ softly.assertThat(it?.githubRepository).isNull()
74
+ softly.assertThat(it?.futureVersionTag).isNull()
75
+ softly.assertThat(it?.sinceTag).isNull()
76
+ }
65
77
}
66
78
}
67
79
@@ -113,6 +125,54 @@ internal class ReleasePluginTest {
113
125
}
114
126
}
115
127
128
+ @Test
129
+ fun testRepository () {
130
+ val project = ProjectBuilder .builder().build()
131
+
132
+ assertThatCode {
133
+ project.extra.set(GITHUB_REPOSITORY , " my-repo" )
134
+ project.pluginManager.apply (" com.bakdata.release" )
135
+ project.evaluate()
136
+ }.doesNotThrowAnyException()
137
+
138
+ SoftAssertions .assertSoftly { softly ->
139
+ softly.assertThat(project.extensions.findByType<GitHubChangelogExtension >()?.githubRepository)
140
+ .isEqualTo(" my-repo" )
141
+ }
142
+ }
143
+
144
+ @Test
145
+ fun testFutureVersionTag () {
146
+ val project = ProjectBuilder .builder().build()
147
+
148
+ assertThatCode {
149
+ project.extra.set(FUTURE_VERSION_TAG , " my-tag" )
150
+ project.pluginManager.apply (" com.bakdata.release" )
151
+ project.evaluate()
152
+ }.doesNotThrowAnyException()
153
+
154
+ SoftAssertions .assertSoftly { softly ->
155
+ softly.assertThat(project.extensions.findByType<GitHubChangelogExtension >()?.futureVersionTag)
156
+ .isEqualTo(" my-tag" )
157
+ }
158
+ }
159
+
160
+ @Test
161
+ fun testSinceTag () {
162
+ val project = ProjectBuilder .builder().build()
163
+
164
+ assertThatCode {
165
+ project.extra.set(SINCE_TAG , " my-tag" )
166
+ project.pluginManager.apply (" com.bakdata.release" )
167
+ project.evaluate()
168
+ }.doesNotThrowAnyException()
169
+
170
+ SoftAssertions .assertSoftly { softly ->
171
+ softly.assertThat(project.extensions.findByType<GitHubChangelogExtension >()?.sinceTag)
172
+ .isEqualTo(" my-tag" )
173
+ }
174
+ }
175
+
116
176
@Test
117
177
fun testWrongApplicationInMultiModuleProject () {
118
178
val parent = ProjectBuilder .builder().withName(" parent" ).build()
0 commit comments