Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling failure on empty beans during serialization #59

Merged
merged 1 commit into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public final class Utils {
JSON_MAPPER = new ObjectMapper();
JSON_MAPPER.registerModule(new JavaTimeModule());
JSON_MAPPER.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
JSON_MAPPER.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
}

private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package com.exceptionless.exceptionlessclient;

import com.exceptionless.exceptionlessclient.configuration.ConfigurationManager;
import com.exceptionless.exceptionlessclient.models.Event;
import com.exceptionless.exceptionlessclient.models.UserDescription;
import com.exceptionless.exceptionlessclient.enums.EventPropertyKey;
import com.exceptionless.exceptionlessclient.enums.EventType;
import com.exceptionless.exceptionlessclient.settings.SettingsResponse;
import com.exceptionless.exceptionlessclient.submission.SubmissionResponse;
import com.exceptionless.exceptionlessclient.models.Event;
import com.exceptionless.exceptionlessclient.models.UserDescription;
import com.exceptionless.exceptionlessclient.queue.DefaultEventQueue;
import com.exceptionless.exceptionlessclient.settings.DefaultSettingsClient;
import com.exceptionless.exceptionlessclient.settings.ServerSettings;
import com.exceptionless.exceptionlessclient.settings.SettingsResponse;
import com.exceptionless.exceptionlessclient.storage.InMemoryStorage;
import com.exceptionless.exceptionlessclient.storage.InMemoryStorageProvider;
import com.exceptionless.exceptionlessclient.submission.DefaultSubmissionClient;
import com.exceptionless.exceptionlessclient.submission.SubmissionResponse;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.exceptionless.exceptionlessclient.utils;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.jupiter.api.Test;

import java.net.URI;
Expand Down Expand Up @@ -80,4 +81,11 @@ public void itCanMatchAValueToAPattern() {
assertThat(Utils.match("abc", "def")).isFalse();
assertThat(Utils.match("ABC", "abc")).isTrue();
}

@Test
public void itCanSerializeEmptyBeans() throws JsonProcessingException {
class EmptyBean {}

assertThat(Utils.JSON_MAPPER.writeValueAsString(new EmptyBean())).isEqualTo("{}");
}
}