Skip to content

Commit

Permalink
fix: Fix tests [adobe#1381]
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardtke committed Feb 6, 2021
1 parent 3de53d7 commit 2661d5e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
package com.adobe.cq.wcm.core.components.internal.models.v1.datalayer;

import com.adobe.cq.wcm.core.components.internal.jackson.ComponentDataModelSerializer;
import com.adobe.cq.wcm.core.components.models.datalayer.ComponentData;
import com.adobe.cq.wcm.core.components.models.datalayer.builder.DataLayerSupplier;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
Expand All @@ -43,9 +41,7 @@ public class ComponentDataImpl implements ComponentData {
/**
* The {@link ObjectWriter} used for JSON serialization. We can safely re-use the instance since it's thread-safe.
*/
private static final ObjectWriter OBJECT_WRITER = new ObjectMapper().registerModule(
new SimpleModule().addSerializer(ComponentData.class, new ComponentDataModelSerializer())
).writer();
private static final ObjectWriter OBJECT_WRITER = new ObjectMapper().writer();

/**
* The current data layer supplier.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
import javax.json.JsonReader;
import javax.json.JsonStructure;

import com.adobe.cq.wcm.core.components.internal.jackson.ComponentDataModelSerializer;
import com.adobe.cq.wcm.core.components.models.datalayer.ComponentData;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.sling.api.resource.Resource;
Expand Down Expand Up @@ -63,6 +65,7 @@ public static void testJSONExport(Object model, String expectedJsonResource) {
mapper.registerModule(pageModuleProvider.getModule());
DefaultMethodSkippingModuleProvider defaultMethodSkippingModuleProvider = new DefaultMethodSkippingModuleProvider();
mapper.registerModule(defaultMethodSkippingModuleProvider.getModule());
mapper.registerModule(new SimpleModule().addSerializer(ComponentData.class, new ComponentDataModelSerializer()));
try {
mapper.writer().writeValue(writer, model);
} catch (IOException e) {
Expand Down

0 comments on commit 2661d5e

Please sign in to comment.