|
10 | 10 | import java.util.Map; |
11 | 11 |
|
12 | 12 | import static org.hamcrest.Matchers.*; |
| 13 | +import static org.junit.Assert.assertThrows; |
13 | 14 |
|
14 | 15 | /** |
15 | 16 | * Tests for the GitHub App API methods |
@@ -40,6 +41,15 @@ public void getGitHubApp() throws IOException { |
40 | 41 | assertThat(app.getPermissions().size(), is(4)); |
41 | 42 | assertThat(app.getEvents().size(), is(2)); |
42 | 43 | assertThat(app.getInstallationsCount(), is((long) 1)); |
| 44 | + |
| 45 | + // Deprecated methods |
| 46 | + assertThrows(RuntimeException.class, () -> app.setDescription("")); |
| 47 | + assertThrows(RuntimeException.class, () -> app.setEvents(null)); |
| 48 | + assertThrows(RuntimeException.class, () -> app.setExternalUrl("")); |
| 49 | + assertThrows(RuntimeException.class, () -> app.setInstallationsCount(1)); |
| 50 | + assertThrows(RuntimeException.class, () -> app.setName("")); |
| 51 | + assertThrows(RuntimeException.class, () -> app.setOwner(null)); |
| 52 | + assertThrows(RuntimeException.class, () -> app.setPermissions(null)); |
43 | 53 | } |
44 | 54 |
|
45 | 55 | @Test |
@@ -113,6 +123,13 @@ public void createToken() throws IOException { |
113 | 123 | assertThat(installationToken.getRepositorySelection(), is(GHRepositorySelection.SELECTED)); |
114 | 124 | assertThat(installationToken.getExpiresAt(), is(GitHubClient.parseDate("2019-08-10T05:54:58Z"))); |
115 | 125 |
|
| 126 | + // Deprecated methods |
| 127 | + assertThrows(RuntimeException.class, () -> installationToken.setPermissions(null)); |
| 128 | + assertThrows(RuntimeException.class, () -> installationToken.setRoot(null)); |
| 129 | + assertThrows(RuntimeException.class, () -> installationToken.setRepositorySelection(null)); |
| 130 | + assertThrows(RuntimeException.class, () -> installationToken.setRepositories(null)); |
| 131 | + assertThrows(RuntimeException.class, () -> installationToken.setPermissions(null)); |
| 132 | + |
116 | 133 | GHRepository repository = installationToken.getRepositories().get(0); |
117 | 134 | assertThat(installationToken.getRepositories().size(), is(1)); |
118 | 135 | assertThat(repository.getId(), is((long) 111111111)); |
@@ -143,6 +160,19 @@ private void testAppInstallation(GHAppInstallation appInstallation) throws IOExc |
143 | 160 | assertThat(appInstallation.getTargetId(), is((long) 111111111)); |
144 | 161 | assertThat(appInstallation.getTargetType(), is(GHTargetType.ORGANIZATION)); |
145 | 162 |
|
| 163 | + // Deprecated methods |
| 164 | + assertThrows(RuntimeException.class, () -> appInstallation.setAccessTokenUrl("")); |
| 165 | + assertThrows(RuntimeException.class, () -> appInstallation.setAccount(null)); |
| 166 | + assertThrows(RuntimeException.class, () -> appInstallation.setAppId(0)); |
| 167 | + assertThrows(RuntimeException.class, () -> appInstallation.setEvents(null)); |
| 168 | + assertThrows(RuntimeException.class, () -> appInstallation.setPermissions(null)); |
| 169 | + assertThrows(RuntimeException.class, () -> appInstallation.setRepositorySelection(null)); |
| 170 | + assertThrows(RuntimeException.class, () -> appInstallation.setRepositoriesUrl(null)); |
| 171 | + assertThrows(RuntimeException.class, () -> appInstallation.setRoot(null)); |
| 172 | + assertThrows(RuntimeException.class, () -> appInstallation.setSingleFileName("")); |
| 173 | + assertThrows(RuntimeException.class, () -> appInstallation.setTargetId(0)); |
| 174 | + assertThrows(RuntimeException.class, () -> appInstallation.setTargetType(null)); |
| 175 | + |
146 | 176 | Map<String, GHPermissionType> permissionsMap = new HashMap<String, GHPermissionType>(); |
147 | 177 | permissionsMap.put("checks", GHPermissionType.WRITE); |
148 | 178 | permissionsMap.put("pull_requests", GHPermissionType.WRITE); |
|
0 commit comments