@@ -44,21 +44,21 @@ public GHOrganizationTest() {
44
44
* @throws IOException
45
45
* Signals that an I/O exception has occurred.
46
46
*/
47
- @ Before
48
- @ After
49
- public void cleanUpTeam () throws IOException {
50
- // Cleanup is only needed when proxying
51
- if (!mockGitHub .isUseProxy ()) {
52
- return ;
53
- }
47
+ @ Before
48
+ @ After
49
+ public void cleanUpTeam () throws IOException {
50
+ // Cleanup is only needed when proxying
51
+ if (!mockGitHub .isUseProxy ()) {
52
+ return ;
53
+ }
54
54
55
- GHTeam team = getNonRecordingGitHub ().getOrganization (GITHUB_API_TEST_ORG ).getTeamByName (TEAM_NAME_CREATE );
56
- if (team != null ) {
57
- team .delete ();
58
- }
55
+ GHTeam team = getNonRecordingGitHub ().getOrganization (GITHUB_API_TEST_ORG ).getTeamByName (TEAM_NAME_CREATE );
56
+ if (team != null ) {
57
+ team .delete ();
58
+ }
59
59
60
- getNonRecordingGitHub ().getOrganization (GITHUB_API_TEST_ORG ).enableOrganizationProjects (true );
61
- }
60
+ getNonRecordingGitHub ().getOrganization (GITHUB_API_TEST_ORG ).enableOrganizationProjects (true );
61
+ }
62
62
63
63
/**
64
64
* Test are organization projects enabled.
@@ -264,6 +264,37 @@ public void testCreateRepositoryWithTemplateAndGHRepository() throws IOException
264
264
265
265
}
266
266
267
+ /**
268
+ * Test create a repository from a template with all branches included
269
+ *
270
+ * @throws IOException
271
+ * Signals that an I/O exception has occurred.
272
+ * @throws InterruptedException
273
+ * Signals that Thread.sleep() was interrupted
274
+ */
275
+
276
+ @ Test
277
+ public void testCreateRepositoryWithTemplateAndIncludeAllBranches () throws IOException , InterruptedException {
278
+ cleanupRepository (GITHUB_API_TEST_ORG + '/' + GITHUB_API_TEST );
279
+
280
+ GHOrganization org = gitHub .getOrganization (GITHUB_API_TEST_ORG );
281
+ GHRepository templateRepository = org .getRepository (GITHUB_API_TEMPLATE_TEST );
282
+
283
+ GHRepository repository = gitHub .createRepository (GITHUB_API_TEST )
284
+ .fromTemplateRepository (templateRepository )
285
+ .includeAllBranches (true )
286
+ .owner (GITHUB_API_TEST_ORG )
287
+ .create ();
288
+
289
+ assertThat (repository , notNullValue ());
290
+
291
+ // give it a moment for branches to be created
292
+ Thread .sleep (1500 );
293
+
294
+ assertThat (repository .getBranches ().keySet (), equalTo (templateRepository .getBranches ().keySet ()));
295
+
296
+ }
297
+
267
298
/**
268
299
* Test create team.
269
300
*
0 commit comments