### Question:
Jackson2ModelSerializer { void serialize(@Nonnull PrintWriter writer, @Nonnull Object model) throws IOException { this.jsonFactory .createGenerator(writer) .setCodec(this.mapper) .writeObject(model); } Jackson2ModelSerializer(@Nonnull Supplier<Map<Object, Mapping<?>>> recordedMappingsSupplier, @Nonnull String[] jacksonConfigurations, boolean addTypeAttribute);   }### Answer:
@Test public void testInvalidSettingsAreSkippedAndValidSettingsAreApplied() throws IOException { withTestModel(new TestModelWithDate()); withSettings("Invalid.Setting=EXPECTED ERROR", "SerializationFeature.WRITE_DATES_AS_TIMESTAMPS=false"); initializeModelSerializer(); serialize(); assertJsonIs("{\"date\":\"1970-01-01T00:00:00.000+0000\"}"); withSettings("Invalid.Setting=EXPECTED ERROR", "SerializationFeature.WRITE_DATES_AS_TIMESTAMPS=true"); initializeModelSerializer(); serialize(); assertJsonIs("{\"date\":0}"); }
@Test public void testSerializationWithoutTypeAttribute() throws IOException { serialize(); assertJsonIs("{\"helloWorld\":\"Hello, world\",\"lazy\":\"Lazy value\",\"resource\":\"/some/resource/path\",\"subModelProperty\":\"sub model property\"}"); }
@Test public void testTypeGeneration() throws IOException { withRecordedMapping(); withTypeGenerationEnabled(); initializeModelSerializer(); serialize(); assertJsonIs("{\":type\":\"some/resource/type\",\"helloWorld\":\"Hello, world\",\"lazy\":\"Lazy value\",\"resource\":\"/some/resource/path\",\"subModelProperty\":\"sub model property\"}"); }