diff --git a/src/main/java/org/gitlab4j/api/systemhooks/MergeRequestSystemHookEvent.java b/src/main/java/org/gitlab4j/api/systemhooks/MergeRequestSystemHookEvent.java index d0f791d2..43ad9d5d 100644 --- a/src/main/java/org/gitlab4j/api/systemhooks/MergeRequestSystemHookEvent.java +++ b/src/main/java/org/gitlab4j/api/systemhooks/MergeRequestSystemHookEvent.java @@ -2,6 +2,8 @@ import org.gitlab4j.api.webhook.MergeRequestEvent; +import com.fasterxml.jackson.annotation.JsonIgnore; + public class MergeRequestSystemHookEvent extends MergeRequestEvent implements SystemHookEvent { private static final long serialVersionUID = 1L; @@ -9,6 +11,7 @@ public class MergeRequestSystemHookEvent extends MergeRequestEvent implements Sy public static final String MERGE_REQUEST_EVENT = "merge_request"; private String eventType; + private String eventName; @Override public String getObjectKind() { @@ -17,14 +20,28 @@ public String getObjectKind() { @Override public String getEventName() { - return (MERGE_REQUEST_EVENT); + return eventName; + } + + public void setEventName(String eventName) { + this.eventName = eventName; } public String getEventType() { return eventType; } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + /** + * @deprecated use {@link #setEventType(String)} instead + * @param eventType + */ + @Deprecated + @JsonIgnore public void setEvent_type(String eventType) { - this.eventType = eventType; + setEventType(eventType); } } diff --git a/src/test/java/org/gitlab4j/api/JsonUtils.java b/src/test/java/org/gitlab4j/api/JsonUtils.java index d90e095e..c3ee53d9 100644 --- a/src/test/java/org/gitlab4j/api/JsonUtils.java +++ b/src/test/java/org/gitlab4j/api/JsonUtils.java @@ -22,6 +22,7 @@ import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.MapperFeature; @@ -34,6 +35,7 @@ public class JsonUtils { jacksonJson = new JacksonJson(); jacksonJson.getObjectMapper().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); jacksonJson.getObjectMapper().configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true); + jacksonJson.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); } static JsonNode readTreeFromMap(Map map) throws JsonParseException, JsonMappingException, IOException { diff --git a/src/test/resources/org/gitlab4j/api/bad-branch.json b/src/test/resources/org/gitlab4j/api/bad-branch.json index 92213a52..0ffc475e 100644 --- a/src/test/resources/org/gitlab4j/api/bad-branch.json +++ b/src/test/resources/org/gitlab4j/api/bad-branch.json @@ -1,20 +1,18 @@ - { - "commit": { - "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", - "parents": [{ "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" }], - "tree": "46e82de44b1061621357f24c05515327f2795a95", - "message": "add projects API", - "author": { - "name": "John Smith", - "email": "john@example.com" - }, - "committer": { - "name": "John Smith", - "email": "john@example.com" - }, - "authored_date": "2012-06-27T12:51:39Z", - "committed_date": "2012-06-28T10:44:20Z" - }, - "protected": true +{ + "commit": { + "author_email": "john@example.com", + "author_name": "John Smith", + "authored_date": "2012-06-27T05:51:39Z", + "committed_date": "2012-06-28T03:44:20Z", + "committer_email": "john@example.com", + "committer_name": "John Smith", + "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", + "short_id": "7b5c3cc", + "title": "add projects API", + "message": "add projects API", + "parent_ids": [ + "4ad91d3c1144c406e50c7b33bae684bd6837faf8" + ] + }, + "protected": true } -