Skip to content

Commit

Permalink
fix: configure the ObjectMapper to prevent from flaky behavior in the…
Browse files Browse the repository at this point in the history
… test case testPublish_Object (#2340)
  • Loading branch information
bjchris32 authored Feb 22, 2024
1 parent f6b5411 commit 8f3afad
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.api.core.ApiService;
import com.google.api.core.SettableApiFuture;
Expand Down Expand Up @@ -79,8 +80,10 @@ private PubSubTemplate createTemplate() {
private PubSubPublisherTemplate createPublisherTemplate() {
PubSubPublisherTemplate pubSubPublisherTemplate =
new PubSubPublisherTemplate(this.mockPublisherFactory);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
pubSubPublisherTemplate.setMessageConverter(
new JacksonPubSubMessageConverter(new ObjectMapper()));
new JacksonPubSubMessageConverter(objectMapper));
return pubSubPublisherTemplate;
}

Expand Down

0 comments on commit 8f3afad

Please sign in to comment.