Unverified Commit 80abfcae authored by Jérémie Bresson's avatar Jérémie Bresson Committed by GitHub
Browse files

Activate FAIL_ON_UNKNOWN_PROPERTIES for tests in JsonUtils (#1089)

parent b60c045d
......@@ -2,6 +2,8 @@ package org.gitlab4j.api.systemhooks;
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 class MergeRequestSystemHookEvent extends MergeRequestEvent implements Sy
@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);
}
}
......@@ -22,6 +22,7 @@ import org.junit.jupiter.api.Assertions;
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<String, Object> map) throws JsonParseException, JsonMappingException, IOException {
......
{
"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
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment