File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
main/java/org/gitlab4j/api/services
test/java/org/gitlab4j/api Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1
1
package org .gitlab4j .api .services ;
2
2
3
+ import java .util .Map ;
4
+
3
5
import javax .xml .bind .annotation .XmlAccessType ;
4
6
import javax .xml .bind .annotation .XmlAccessorType ;
5
7
import javax .xml .bind .annotation .XmlRootElement ;
@@ -109,4 +111,28 @@ public JiraService withJiraIssueTransitionId(Integer jiraIssueTransitionId) {
109
111
setJiraIssueTransitionId (jiraIssueTransitionId );
110
112
return (this );
111
113
}
114
+
115
+ @ Override
116
+ public void setProperties (Map <String , Object > properties ) {
117
+ fixJiraIssueTransitionId (properties );
118
+ super .setProperties (properties );
119
+ }
120
+
121
+ /**
122
+ * Make sure jiraIssueTransitionId is an integer and not an empty string.
123
+ * @param properties the Map holding the properties
124
+ */
125
+ private void fixJiraIssueTransitionId (Map <String , Object > properties ) {
126
+
127
+ if (properties != null ) {
128
+ Object jiraIssueTransitionId = properties .get (JIRA_ISSUE_TRANSITION_ID_PROP );
129
+ if (jiraIssueTransitionId instanceof String ) {
130
+ if (((String )jiraIssueTransitionId ).trim ().isEmpty ()) {
131
+ properties .put (JIRA_ISSUE_TRANSITION_ID_PROP , null );
132
+ } else {
133
+ properties .put (JIRA_ISSUE_TRANSITION_ID_PROP , Integer .valueOf ((String )jiraIssueTransitionId ));
134
+ }
135
+ }
136
+ }
137
+ }
112
138
}
Original file line number Diff line number Diff line change @@ -105,8 +105,14 @@ public void testProjectIdOrPath() throws GitLabApiException {
105
105
106
106
@ Test
107
107
public void testGetJiraService () throws GitLabApiException {
108
+
108
109
JiraService jiraService = gitLabApi .getServicesApi ().getJiraService (testProject );
109
110
assertNotNull (jiraService );
111
+
112
+ // Make sure the jira_issue_transition_id is retrievable.
113
+ // This is testing that a class cast exception is not thrown.
114
+ Integer jiraIssueTransitionId = jiraService .getJiraIssueTransitionId ();
115
+ assertTrue (jiraIssueTransitionId == null || jiraIssueTransitionId != null );
110
116
}
111
117
112
118
@ Test
You can’t perform that action at this time.
0 commit comments