@@ -140,7 +140,7 @@ void generateWhenHasExcludedContributors() throws Exception {
140
140
issues .add (newPullRequest ("Enhancement 1" , "1" , Type .ENHANCEMENT , "enhancement-1-url" , contributor1 ));
141
141
issues .add (newPullRequest ("Enhancement 2" , "2" , Type .ENHANCEMENT , "enhancement-2-url" , contributor2 ));
142
142
given (this .service .getIssuesForMilestone (23 , REPO )).willReturn (issues );
143
- ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , null , null ,
143
+ ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , "## " , null , null ,
144
144
new Contributors (null , new ContributorsExclude (Collections .singleton ("contributor1" ))), null );
145
145
this .generator = new ChangelogGenerator (this .service , properties );
146
146
assertChangelog ("23" ).hasContent (from ("output-with-excluded-contributors" ));
@@ -154,7 +154,7 @@ void generateWhenHasAllContributorsExcluded() throws Exception {
154
154
issues .add (newPullRequest ("Enhancement 1" , "1" , Type .ENHANCEMENT , "enhancement-1-url" , contributor1 ));
155
155
issues .add (newPullRequest ("Enhancement 2" , "2" , Type .ENHANCEMENT , "enhancement-2-url" , contributor2 ));
156
156
given (this .service .getIssuesForMilestone (23 , REPO )).willReturn (issues );
157
- ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , null , null ,
157
+ ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , "## " , null , null ,
158
158
new Contributors (null , new ContributorsExclude (Collections .singleton ("*" ))), null );
159
159
this .generator = new ChangelogGenerator (this .service , properties );
160
160
assertChangelog ("23" ).hasContent (from ("output-with-all-contributors-excluded" ));
@@ -224,7 +224,7 @@ void generateWhenSectionSortedByTitle() throws Exception {
224
224
List <Section > sections = new ArrayList <>();
225
225
Set <String > labels = Collections .singleton ("type: enhancement" );
226
226
sections .add (new Section ("Enhancements" , null , IssueSort .TITLE , labels ));
227
- ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , sections ,
227
+ ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , "## " , sections ,
228
228
new Issues (null , null , null ), null , null );
229
229
this .generator = new ChangelogGenerator (this .service , properties );
230
230
List <Issue > issues = new ArrayList <>();
@@ -240,7 +240,7 @@ void generateWhenAllIssuesSortedByTitle() throws Exception {
240
240
List <Section > sections = new ArrayList <>();
241
241
Set <String > labels = Collections .singleton ("type: enhancement" );
242
242
sections .add (new Section ("Enhancements" , null , null , labels ));
243
- ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , sections ,
243
+ ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , "## " , sections ,
244
244
new Issues (IssueSort .TITLE , null , null ), null , null );
245
245
this .generator = new ChangelogGenerator (this .service , properties );
246
246
List <Issue > issues = new ArrayList <>();
@@ -257,7 +257,7 @@ void generateWhenHasCustomContributorsTitle() throws Exception {
257
257
List <Issue > issues = new ArrayList <>();
258
258
issues .add (newPullRequest ("Bug 1" , "1" , Type .BUG , "bug-1-url" , contributor1 ));
259
259
given (this .service .getIssuesForMilestone (23 , REPO )).willReturn (issues );
260
- ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , null , null ,
260
+ ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , "## " , null , null ,
261
261
new Contributors (":heart: Teamwork" , null ), null );
262
262
this .generator = new ChangelogGenerator (this .service , properties );
263
263
assertChangelog ("23" ).hasContent (from ("output-with-custom-contributors-title" ));
@@ -267,8 +267,8 @@ void generateWhenHasCustomContributorsTitle() throws Exception {
267
267
void generateWhenOneExternalLink () throws Exception {
268
268
List <ExternalLink > externalLinks = new ArrayList <>();
269
269
externalLinks .add (new ExternalLink ("Release Notes Link 1" , "url1" ));
270
- ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , null , null , null ,
271
- externalLinks );
270
+ ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , "## " , null , null ,
271
+ null , externalLinks );
272
272
this .generator = new ChangelogGenerator (this .service , properties );
273
273
assertChangelog ("23" ).hasContent (from ("output-with-one-external-link" ));
274
274
}
@@ -279,18 +279,47 @@ void generateWhenMultipleExternalLink() throws Exception {
279
279
externalLinks .add (new ExternalLink ("Release Notes Link 1" , "url1" ));
280
280
externalLinks .add (new ExternalLink ("Release Notes Link 2" , "url2" ));
281
281
externalLinks .add (new ExternalLink ("Release Notes Link 3" , "url3" ));
282
- ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , null , null , null ,
283
- externalLinks );
282
+ ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , "## " , null , null ,
283
+ null , externalLinks );
284
284
this .generator = new ChangelogGenerator (this .service , properties );
285
285
assertChangelog ("23" ).hasContent (from ("output-with-multiple-external-link" ));
286
286
}
287
287
288
+ @ Test
289
+ void generateWithCustomDefaultTitlePrefix () throws Exception {
290
+ User contributor1 = createUser ("contributor1" , "contributor1-github-url" );
291
+ User contributor2 = createUser ("contributor2" , "contributor2-github-url" );
292
+
293
+ List <Issue > issues = new ArrayList <>();
294
+ issues .add (newPullRequest ("Enhancement 1" , "1" , Type .ENHANCEMENT , "enhancement-1-url" , contributor1 ));
295
+ issues .add (newPullRequest ("Enhancement 2" , "2" , Type .ENHANCEMENT , "enhancement-2-url" , contributor2 ));
296
+ issues .add (newIssue ("Enhancement c" , "1" , "enhancement-1-url" , Type .ENHANCEMENT ));
297
+ issues .add (newIssue ("Enhancement z" , "2" , "enhancement-2-url" , Type .ENHANCEMENT ));
298
+ issues .add (newIssue ("enHAncEMent a" , "3" , "enhancement-3-url" , Type .ENHANCEMENT ));
299
+ given (this .service .getIssuesForMilestone (23 , REPO )).willReturn (issues );
300
+
301
+ List <Section > sections = new ArrayList <>();
302
+ Set <String > labels = Collections .singleton ("type: enhancement" );
303
+ sections .add (new Section ("Enhancements" , null , IssueSort .TITLE , labels ));
304
+
305
+ List <ExternalLink > externalLinks = new ArrayList <>();
306
+ externalLinks .add (new ExternalLink ("Release Notes Link 1" , "url1" ));
307
+ externalLinks .add (new ExternalLink ("Release Notes Link 2" , "url2" ));
308
+ externalLinks .add (new ExternalLink ("Release Notes Link 3" , "url3" ));
309
+
310
+ ApplicationProperties properties = new ApplicationProperties (REPO , MilestoneReference .ID , "== " , sections ,
311
+ new Issues (IssueSort .TITLE , null , null ), new Contributors (null , null ), externalLinks );
312
+ this .generator = new ChangelogGenerator (this .service , properties );
313
+
314
+ assertChangelog ("23" ).hasContent (from ("output-with-custom-title-prefix" ));
315
+ }
316
+
288
317
private void setupGenerator (MilestoneReference id ) {
289
318
Set <String > labels = new HashSet <>(Arrays .asList ("duplicate" , "wontfix" ));
290
319
PortedIssue forwardPort = new PortedIssue ("status: forward-port" , "Forward port of issue #(\\ d+)" );
291
320
PortedIssue cherryPick = new PortedIssue ("status: back-port" , "Back port of issue #(\\ d+)" );
292
321
Set <PortedIssue > portedIssues = new HashSet <>(Arrays .asList (forwardPort , cherryPick ));
293
- ApplicationProperties properties = new ApplicationProperties (REPO , id , null ,
322
+ ApplicationProperties properties = new ApplicationProperties (REPO , id , "## " , null ,
294
323
new Issues (null , new IssuesExclude (labels ), portedIssues ), null , null );
295
324
this .generator = new ChangelogGenerator (this .service , properties );
296
325
}
0 commit comments