Skip to content

Commit

Permalink
GH-209 - Register Jackson auto-configuration with @WebMvcTest explici…
Browse files Browse the repository at this point in the history
…tly.
  • Loading branch information
odrotbohm committed Dec 19, 2023
1 parent 815cadc commit 08e4948
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jmolecules-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.jmolecules.jackson.config.JMoleculesJacksonAutoConfiguration
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jmolecules.jackson.config;

import static org.assertj.core.api.Assertions.*;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;

import com.fasterxml.jackson.databind.ObjectMapper;

/**
* @author Oliver Drotbohm
*/
@WebMvcTest
class WebMvcTestAutoConfigurationTests {

@Autowired ObjectMapper mapper;

@SpringBootApplication
static class Sample {}

@Test // #209
void registersJMoleculesModuleForAtJsonTest() throws Exception {
assertThat(mapper.getRegisteredModuleIds()).contains("jmolecules-module");
}
}

0 comments on commit 08e4948

Please sign in to comment.