Skip to content

Commit 40a846f

Browse files
committed
Added tests for NotificationSettings (#143).
1 parent a252e37 commit 40a846f

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/main/java/org/gitlab4j/api/GitLabApi.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public String getApiNamespace() {
4949
private MergeRequestApi mergeRequestApi;
5050
private MilestonesApi milestonesApi;
5151
private NamespaceApi namespaceApi;
52+
private NotificationSettingsApi notificationSettingsApi;
5253
private PipelineApi pipelineApi;
5354
private ProjectApi projectApi;
5455
private RepositoryApi repositoryApi;
@@ -848,6 +849,25 @@ public NotesApi getNotesApi() {
848849
return (notesApi);
849850
}
850851

852+
/**
853+
* Gets the NotesApi instance owned by this GitLabApi instance. The NotesApi is used
854+
* to perform all notes related API calls.
855+
*
856+
* @return the NotesApi instance owned by this GitLabApi instance
857+
*/
858+
public NotificationSettingsApi getNotificationSettingsApi() {
859+
860+
if (notificationSettingsApi == null) {
861+
synchronized (this) {
862+
if (notificationSettingsApi == null) {
863+
notificationSettingsApi = new NotificationSettingsApi(this);
864+
}
865+
}
866+
}
867+
868+
return (notificationSettingsApi);
869+
}
870+
851871
/**
852872
* Gets the PipelineApi instance owned by this GitLabApi instance. The PipelineApi is used
853873
* to perform all pipeline related API calls.

src/test/java/org/gitlab4j/api/TestGitLabApiBeans.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.gitlab4j.api.models.MergeRequest;
4949
import org.gitlab4j.api.models.Milestone;
5050
import org.gitlab4j.api.models.Note;
51+
import org.gitlab4j.api.models.NotificationSettings;
5152
import org.gitlab4j.api.models.OauthTokenResponse;
5253
import org.gitlab4j.api.models.Pipeline;
5354
import org.gitlab4j.api.models.Project;
@@ -331,6 +332,17 @@ public void testNote() {
331332
}
332333
}
333334

335+
@Test
336+
public void testNotificationSettings() {
337+
338+
try {
339+
NotificationSettings settings = makeFakeApiCall(NotificationSettings.class, "notification-settings");
340+
assertTrue(compareJson(settings, "notification-settings"));
341+
} catch (Exception e) {
342+
e.printStackTrace();
343+
}
344+
}
345+
334346
@Test
335347
public void testProject() {
336348

0 commit comments

Comments
 (0)