Merge branch 'master' into BAEL-20863-move-spring-boot-ctx-fluent
This commit is contained in:
commit
b952ffecca
|
@ -77,7 +77,7 @@
|
|||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-eclipse-compiler</artifactId>
|
||||
<version>3.3.0-01</version>
|
||||
<version>${groovy.compiler.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
|
|
|
@ -33,7 +33,6 @@ class ReadFileUnitTest extends Specification {
|
|||
assert lines.size(), 3
|
||||
}
|
||||
|
||||
@Ignore
|
||||
def 'Should return file content in string using ReadFile.readFileString given filePath' () {
|
||||
given:
|
||||
def filePath = "src/main/resources/fileContent.txt"
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<version>${shade.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -109,6 +109,7 @@
|
|||
<uberjar.name>benchmarks</uberjar.name>
|
||||
<jmh.version>1.22</jmh.version>
|
||||
<eclipse.collections.version>10.0.0</eclipse.collections.version>
|
||||
<shade.plugin.version>10.0.0</shade.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
package com.baeldung.threadlocalrandom;
|
||||
|
||||
import org.openjdk.jmh.runner.Runner;
|
||||
import org.openjdk.jmh.runner.options.Options;
|
||||
import org.openjdk.jmh.runner.options.ChainedOptionsBuilder;
|
||||
import org.openjdk.jmh.runner.options.OptionsBuilder;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class ThreadLocalRandomBenchMarkRunner {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Options options = new OptionsBuilder().include(ThreadLocalRandomBenchMarker.class.getSimpleName())
|
||||
.threads(1)
|
||||
ChainedOptionsBuilder options = new OptionsBuilder().include(ThreadLocalRandomBenchMarker.class.getSimpleName())
|
||||
.forks(1)
|
||||
.shouldFailOnError(true)
|
||||
.shouldDoGC(true)
|
||||
.jvmArgs("-server")
|
||||
.build();
|
||||
|
||||
new Runner(options).run();
|
||||
.jvmArgs("-server");
|
||||
|
||||
for (Integer i : ImmutableList.of(1, 2, 8, 32)) {
|
||||
new Runner(
|
||||
options
|
||||
.threads(i)
|
||||
.build())
|
||||
.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,64 +1,34 @@
|
|||
package com.baeldung.threadlocalrandom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.openjdk.jmh.annotations.Benchmark;
|
||||
import org.openjdk.jmh.annotations.BenchmarkMode;
|
||||
import org.openjdk.jmh.annotations.Level;
|
||||
import org.openjdk.jmh.annotations.Mode;
|
||||
import org.openjdk.jmh.annotations.OutputTimeUnit;
|
||||
import org.openjdk.jmh.annotations.Scope;
|
||||
import org.openjdk.jmh.annotations.Setup;
|
||||
import org.openjdk.jmh.annotations.State;
|
||||
import org.openjdk.jmh.annotations.Warmup;
|
||||
|
||||
@BenchmarkMode(Mode.AverageTime)
|
||||
@BenchmarkMode(Mode.Throughput)
|
||||
@Warmup(iterations = 1)
|
||||
@OutputTimeUnit(TimeUnit.MICROSECONDS)
|
||||
@State(Scope.Benchmark)
|
||||
public class ThreadLocalRandomBenchMarker {
|
||||
private final Random random = new Random();
|
||||
|
||||
List<Callable<Integer>> randomCallables = new ArrayList<>();
|
||||
List<Callable<Integer>> threadLocalRandomCallables = new ArrayList<>();
|
||||
|
||||
@Setup(Level.Iteration)
|
||||
public void init() {
|
||||
Random random = new Random();
|
||||
randomCallables = new ArrayList<>();
|
||||
threadLocalRandomCallables = new ArrayList<>();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
randomCallables.add(() -> {
|
||||
@Benchmark
|
||||
public int randomValuesUsingRandom() {
|
||||
return random.nextInt();
|
||||
});
|
||||
}
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
threadLocalRandomCallables.add(() -> {
|
||||
return ThreadLocalRandom.current()
|
||||
@Benchmark
|
||||
public int randomValuesUsingThreadLocalRandom() {
|
||||
return ThreadLocalRandom
|
||||
.current()
|
||||
.nextInt();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void randomValuesUsingRandom() throws InterruptedException {
|
||||
ExecutorService executor = Executors.newWorkStealingPool();
|
||||
executor.invokeAll(randomCallables);
|
||||
executor.shutdown();
|
||||
}
|
||||
|
||||
@Benchmark
|
||||
public void randomValuesUsingThreadLocalRandom() throws InterruptedException {
|
||||
ExecutorService executor = Executors.newWorkStealingPool();
|
||||
executor.invokeAll(threadLocalRandomCallables);
|
||||
executor.shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<dependency>
|
||||
<groupId>com.leansoft</groupId>
|
||||
<artifactId>bigqueue</artifactId>
|
||||
<version>0.7.0</version>
|
||||
<version>${bigqueue.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -39,4 +39,8 @@
|
|||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<bigqueue.version>0.7.0</bigqueue.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -177,8 +177,8 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<source>${source.version}</source>
|
||||
<target>${target.version}</target>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
@ -189,7 +189,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>${maven-war-plugin.version}</version>
|
||||
<configuration>
|
||||
<warSourceDirectory>src/main/webapp</warSourceDirectory>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
|
@ -216,7 +216,5 @@
|
|||
<slf4j.version>1.7.25</slf4j.version>
|
||||
<spring-boot-maven-plugin.version>2.0.4.RELEASE</spring-boot-maven-plugin.version>
|
||||
<compiler.plugin.version>3.1</compiler.plugin.version>
|
||||
<source.version>1.8</source.version>
|
||||
<target.version>1.8</target.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<dependency>
|
||||
<groupId>it.unimi.dsi</groupId>
|
||||
<artifactId>dsiutils</artifactId>
|
||||
<version>2.6.0</version>
|
||||
<version>${dsiutils.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -31,4 +31,8 @@
|
|||
</resources>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<dsiutils.version>2.6.0</dsiutils.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -232,7 +232,7 @@
|
|||
<dependency>
|
||||
<groupId>org.zalando</groupId>
|
||||
<artifactId>problem-spring-web</artifactId>
|
||||
<version>0.24.0-RC.0</version>
|
||||
<version>${zalando.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth</groupId>
|
||||
|
@ -910,5 +910,6 @@
|
|||
<sonar.tests>${project.basedir}/src/test/</sonar.tests>
|
||||
|
||||
<!-- jhipster-needle-maven-property -->
|
||||
<zalando.version>0.24.0-RC.0</zalando.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<dependency>
|
||||
<groupId>io.reactivex.rxjava2</groupId>
|
||||
<artifactId>rxkotlin</artifactId>
|
||||
<version>2.3.0</version>
|
||||
<version>${rxkotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@ -86,6 +86,7 @@
|
|||
<guava.version>27.1-jre</guava.version>
|
||||
<mockk.version>1.9.3</mockk.version>
|
||||
<kotlinx-collections-immutable.version>0.1</kotlinx-collections-immutable.version>
|
||||
<rxkotlin.version>2.3.0</rxkotlin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<version>${junit.version}</version>
|
||||
</dependency>
|
||||
<!-- logging -->
|
||||
<dependency>
|
||||
|
@ -148,6 +148,7 @@
|
|||
<dependency.plugin.version>3.1.1</dependency.plugin.version>
|
||||
<surefire.plugin.version>2.22.1</surefire.plugin.version>
|
||||
<exec.plugin.version>1.3.2</exec.plugin.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-help-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<version>${help.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>show-profiles</id>
|
||||
|
@ -87,4 +87,8 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<help.plugin.version>3.2.0</help.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -46,7 +46,7 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
<version>${versions.plugin.version}</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>org.apache.commons:commons-collections4</exclude>
|
||||
|
@ -76,6 +76,7 @@
|
|||
<commons-collections4.version>4.0</commons-collections4.version>
|
||||
<commons-lang3.version>3.0</commons-lang3.version>
|
||||
<commons-beanutils.version>1.9.1</commons-beanutils.version>
|
||||
<versions.plugin.version>2.7</versions.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -16,6 +16,12 @@
|
|||
<bootstrap.version>3.3.4</bootstrap.version>
|
||||
<jquery.version>2.1.3</jquery.version>
|
||||
<h2.version>1.4.186</h2.version>
|
||||
<compiler.plugin.version>3.2</compiler.plugin.version>
|
||||
<source.version>1.8</source.version>
|
||||
<target.version>1.8</target.version>
|
||||
<enforcer.plugin.version>1.3.1</enforcer.plugin.version>
|
||||
<deploy.plugin.version>2.8.2</deploy.plugin.version>
|
||||
<shade.plugin.version>2.2</shade.plugin.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
@ -23,16 +29,16 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.2</version>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>${source.version}</source>
|
||||
<target>${target.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<version>${enforcer.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-banned-dependencies</id>
|
||||
|
@ -95,7 +101,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
<version>${deploy.plugin.version}</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
|
@ -103,7 +109,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<version>${shade.plugin.version}</version>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<filters>
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.2.0.M4</version>
|
||||
<version>${boot.dependencies.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -215,6 +215,7 @@
|
|||
<ktor.io.version>0.9.5</ktor.io.version>
|
||||
<assertj.version>3.12.0</assertj.version>
|
||||
<junit.platform.version>1.3.2</junit.platform.version>
|
||||
<boot.dependencies.version>2.2.0.M4</boot.dependencies.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>1.2.0.Final</version>
|
||||
<version>${mapstruct-jdk8.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -93,6 +93,15 @@
|
|||
Name of the benchmark Uber-JAR to generate.
|
||||
-->
|
||||
<uberjar.name>benchmarks</uberjar.name>
|
||||
<compiler.plugin.version>3.1</compiler.plugin.version>
|
||||
<shade.plugin.version>2.2</shade.plugin.version>
|
||||
<install.version>2.5.1</install.version>
|
||||
<jar.plugin.version>2.4</jar.plugin.version>
|
||||
<javadoc.plugin.version>2.9.1</javadoc.plugin.version>
|
||||
<resources.plugin.version>2.6</resources.plugin.version>
|
||||
<site.plugin.version>3.3</site.plugin.version>
|
||||
<source.plugin.version>2.2.1</source.plugin.version>
|
||||
<surefire.plugin.version>2.17</surefire.plugin.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
@ -100,7 +109,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<compilerVersion>${javac.target}</compilerVersion>
|
||||
<source>${javac.target}</source>
|
||||
|
@ -117,7 +126,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<version>${shade.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -162,31 +171,31 @@
|
|||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<version>${install.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>${jar.plugin.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<version>${javadoc.plugin.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<version>${resources.plugin.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<version>${site.plugin.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<version>${source.plugin.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.17</version>
|
||||
<version>${surefire.plugin.version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
<version>${commons.lang3.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -66,6 +66,9 @@
|
|||
<commons-lang3.version>3.8.1</commons-lang3.version>
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
<spring-boot.version>2.1.7.RELEASE</spring-boot.version>
|
||||
<hibernate.core.version>5.4.7.Final</hibernate.core.version>
|
||||
<h2.version>1.4.200</h2.version>
|
||||
<commons.lang3.version>3.8.1</commons.lang3.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<version>${exec-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>document</id>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<release>${maven.release.version}</release>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
|
@ -39,7 +39,7 @@
|
|||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
<version>6.1</version> <!-- Use newer version of ASM -->
|
||||
<version>${asm.version}</version> <!-- Use newer version of ASM -->
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
@ -50,6 +50,8 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.release.version>11</maven.release.version>
|
||||
<sirix-core.version>0.9.3</sirix-core.version>
|
||||
<compiler.plugin.version>3.8.0</compiler.plugin.version>
|
||||
<asm.version>6.1</asm.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>2.1.8.RELEASE</version>
|
||||
<version>${spring.boot.dependencies}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -95,6 +95,7 @@
|
|||
|
||||
<properties>
|
||||
<jdbi.version>3.9.1</jdbi.version>
|
||||
<spring.boot.dependencies>2.1.8.RELEASE</spring.boot.dependencies>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>${spring-boot-version}</version>
|
||||
<version>${spring.boot.starter.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -88,6 +88,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<start-class>com.baeldung.springdatageode.app.ClientCacheApp</start-class>
|
||||
<spring-geode-starter-version>1.1.1.RELEASE</spring-geode-starter-version>
|
||||
<spring.boot.starter.version>2.1.9.RELEASE</spring.boot.starter.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
6
pom.xml
6
pom.xml
|
@ -641,7 +641,6 @@
|
|||
<module>spring-boot</module>
|
||||
<module>spring-boot-modules</module>
|
||||
<module>spring-boot-angular</module>
|
||||
<module>spring-boot-autoconfiguration</module>
|
||||
<module>spring-boot-bootstrap</module>
|
||||
<module>spring-boot-camel</module>
|
||||
<!-- <module>spring-boot-cli</module> --> <!-- Not a maven project -->
|
||||
|
@ -649,11 +648,11 @@
|
|||
<module>spring-boot-config-jpa-error</module>
|
||||
<module>spring-boot-crud</module>
|
||||
<module>spring-boot-custom-starter</module>
|
||||
<module>spring-boot-ctx-fluent</module>
|
||||
<module>spring-boot-deployment</module>
|
||||
<module>spring-boot-di</module>
|
||||
<module>spring-boot-environment</module>
|
||||
<module>spring-boot-flowable</module>
|
||||
<!-- <module>spring-boot-gradle</module> --> <!-- Not a maven project -->
|
||||
<module>spring-boot-jasypt</module>
|
||||
<module>spring-boot-kotlin</module>
|
||||
<module>spring-boot-libraries</module>
|
||||
|
@ -1170,7 +1169,6 @@
|
|||
<module>spring-boot</module>
|
||||
<module>spring-boot-modules</module>
|
||||
<module>spring-boot-angular</module>
|
||||
<module>spring-boot-autoconfiguration</module>
|
||||
<module>spring-boot-bootstrap</module>
|
||||
<module>spring-boot-camel</module>
|
||||
<!-- <module>spring-boot-cli</module> --> <!-- Not a maven project -->
|
||||
|
@ -1178,11 +1176,11 @@
|
|||
<module>spring-boot-config-jpa-error</module>
|
||||
<module>spring-boot-crud</module>
|
||||
<module>spring-boot-custom-starter</module>
|
||||
<module>spring-boot-ctx-fluent</module>
|
||||
<module>spring-boot-deployment</module>
|
||||
<module>spring-boot-di</module>
|
||||
<module>spring-boot-environment</module>
|
||||
<module>spring-boot-flowable</module>
|
||||
<!-- <module>spring-boot-gradle</module> --> <!-- Not a maven project -->
|
||||
<module>spring-boot-jasypt</module>
|
||||
<module>spring-boot-kotlin</module>
|
||||
<module>spring-boot-libraries</module>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
|
@ -54,4 +54,8 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<compiler.plugin.version>3.8.1</compiler.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -50,7 +50,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
|
@ -66,6 +66,8 @@
|
|||
|
||||
<properties>
|
||||
<liquibase-core.version>3.8.1</liquibase-core.version>
|
||||
<compiler.plugin.version>3.8.1</compiler.plugin.version>
|
||||
<liquibase.version>3.8.1</liquibase.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -39,16 +39,16 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>${dependency.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
|
@ -84,6 +84,8 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spf4j.version>8.6.10</spf4j.version>
|
||||
<org.slf4j.version>1.7.21</org.slf4j.version>
|
||||
<compiler.plugin.version>3.8.0</compiler.plugin.version>
|
||||
<dependency.plugin.version>3.1.1</dependency.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -39,16 +39,16 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<version>${compiler.plugin.version}</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>${dependency.plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
|
@ -84,6 +84,8 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spf4j.version>8.6.10</spf4j.version>
|
||||
<org.slf4j.version>1.7.21</org.slf4j.version>
|
||||
<compiler.plugin.version>3.8.0</compiler.plugin.version>
|
||||
<dependency.plugin.version>3.1.1</dependency.plugin.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
Binary file not shown.
|
@ -15,9 +15,12 @@
|
|||
|
||||
<modules>
|
||||
<module>spring-boot-admin</module>
|
||||
<module>spring-boot-custom-starter</module>
|
||||
<module>spring-boot-artifacts</module>
|
||||
<module>spring-boot-ctx-fluent</module>
|
||||
<module>spring-boot-autoconfiguration</module>
|
||||
<module>spring-boot-data</module>
|
||||
<!-- <module>spring-boot-gradle</module> --> <!-- Not a maven project -->
|
||||
<module>spring-boot-keycloak</module>
|
||||
<module>spring-boot-mvc-birt</module>
|
||||
<module>spring-boot-performance</module>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
|
@ -7,10 +7,9 @@
|
|||
<name>greeter-library</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||
<artifactId>spring-boot-custom-starter</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../spring-boot-custom-starter</relativePath>
|
||||
</parent>
|
||||
|
||||
</project>
|
|
@ -7,10 +7,9 @@
|
|||
<name>greeter-spring-boot-autoconfigure</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||
<artifactId>spring-boot-custom-starter</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../spring-boot-custom-starter</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -34,7 +33,7 @@
|
|||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||
<artifactId>greeter-library</artifactId>
|
||||
<version>${greeter.version}</version>
|
||||
<optional>true</optional>
|
|
@ -10,12 +10,12 @@
|
|||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-1</relativePath>
|
||||
<relativePath>../../../parent-boot-1</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||
<artifactId>greeter-spring-boot-starter</artifactId>
|
||||
<version>${greeter-starter.version}</version>
|
||||
</dependency>
|
|
@ -7,10 +7,9 @@
|
|||
<name>greeter-spring-boot-starter</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||
<artifactId>spring-boot-custom-starter</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../spring-boot-custom-starter</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -22,13 +21,13 @@
|
|||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||
<artifactId>greeter-spring-boot-autoconfigure</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||
<artifactId>greeter-library</artifactId>
|
||||
<version>${greeter.version}</version>
|
||||
</dependency>
|
|
@ -10,7 +10,7 @@
|
|||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-1</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-1</relativePath>
|
||||
<relativePath>../../../parent-boot-1</relativePath>
|
||||
</parent>
|
||||
|
||||
</project>
|
|
@ -8,8 +8,8 @@
|
|||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<groupId>com.baeldung.spring-boot-modules</groupId>
|
||||
<artifactId>spring-boot-modules</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
|
@ -2,9 +2,6 @@ package com.baeldung.beanvalidation.application;
|
|||
|
||||
import com.baeldung.beanvalidation.application.controllers.UserController;
|
||||
import com.baeldung.beanvalidation.application.repositories.UserRepository;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import org.hamcrest.core.Is;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
@ -18,6 +15,10 @@ import org.springframework.test.web.servlet.MockMvc;
|
|||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@WebMvcTest
|
||||
@AutoConfigureMockMvc
|
||||
|
@ -40,9 +41,9 @@ public class UserControllerIntegrationTest {
|
|||
@Test
|
||||
public void whenGetRequestToUsers_thenCorrectResponse() throws Exception {
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/users")
|
||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andExpect(MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON_UTF8));
|
||||
.andExpect(MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON));
|
||||
|
||||
}
|
||||
|
||||
|
@ -52,7 +53,7 @@ public class UserControllerIntegrationTest {
|
|||
String user = "{\"name\": \"bob\", \"email\" : \"bob@domain.com\"}";
|
||||
mockMvc.perform(MockMvcRequestBuilders.post("/users")
|
||||
.content(user)
|
||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(MockMvcResultMatchers.status().isOk())
|
||||
.andExpect(MockMvcResultMatchers.content().contentType(textPlainUtf8));
|
||||
}
|
||||
|
@ -62,9 +63,9 @@ public class UserControllerIntegrationTest {
|
|||
String user = "{\"name\": \"\", \"email\" : \"bob@domain.com\"}";
|
||||
mockMvc.perform(MockMvcRequestBuilders.post("/users")
|
||||
.content(user)
|
||||
.contentType(MediaType.APPLICATION_JSON_UTF8))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(MockMvcResultMatchers.status().isBadRequest())
|
||||
.andExpect(MockMvcResultMatchers.jsonPath("$.name", Is.is("Name is mandatory")))
|
||||
.andExpect(MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON_UTF8));
|
||||
.andExpect(MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
|
|||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
|
@ -39,31 +37,23 @@ public class SpringBootApplicationIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void givenRequestHasBeenMade_whenMeetsAllOfGivenConditions_thenCorrect() throws Exception {
|
||||
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
||||
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/all")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)).andExpect(jsonPath("$", hasSize(4)));
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/all")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON)).andExpect(jsonPath("$", hasSize(4)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenRequestHasBeenMade_whenMeetsFindByDateOfGivenConditions_thenCorrect() throws Exception {
|
||||
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
||||
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbydate/{date}", "2011-12-03T10:15:30")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType))
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbydate/{date}", "2011-12-03T10:15:30")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath("$.id", equalTo(1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenRequestHasBeenMade_whenMeetsFindByModeOfGivenConditions_thenCorrect() throws Exception {
|
||||
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
||||
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbymode/{mode}", Modes.ALPHA.name())).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType)).andExpect(jsonPath("$.id", equalTo(1)));
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbymode/{mode}", Modes.ALPHA.name())).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON)).andExpect(jsonPath("$.id", equalTo(1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenRequestHasBeenMade_whenMeetsFindByVersionOfGivenConditions_thenCorrect() throws Exception {
|
||||
MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
|
||||
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion").header("Version", "1.0.0")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(contentType))
|
||||
mockMvc.perform(MockMvcRequestBuilders.get("/entity/findbyversion").header("Version", "1.0.0")).andExpect(MockMvcResultMatchers.status().isOk()).andExpect(MockMvcResultMatchers.content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath("$.id", equalTo(1)));
|
||||
}
|
||||
}
|
|
@ -1,9 +1,5 @@
|
|||
package com.baeldung.web.controller;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||
|
@ -12,6 +8,10 @@ import org.springframework.http.HttpHeaders;
|
|||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
public class EmployeeControllerContentNegotiationIntegrationTest {
|
||||
|
@ -23,7 +23,7 @@ public class EmployeeControllerContentNegotiationIntegrationTest {
|
|||
public void whenEndpointUsingJsonSuffixCalled_thenJsonResponseObtained() throws Exception {
|
||||
this.mockMvc.perform(get("/employee/1.json"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE));
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -37,7 +37,7 @@ public class EmployeeControllerContentNegotiationIntegrationTest {
|
|||
public void whenEndpointUsingJsonParameterCalled_thenJsonResponseObtained() throws Exception {
|
||||
this.mockMvc.perform(get("/employee/1?mediaType=json"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE));
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -51,7 +51,7 @@ public class EmployeeControllerContentNegotiationIntegrationTest {
|
|||
public void whenEndpointUsingJsonAcceptHeaderCalled_thenJsonResponseObtained() throws Exception {
|
||||
this.mockMvc.perform(get("/employee/1").header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE));
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
package com.baeldung.web.controller;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
public class SimpleBookControllerIntegrationTest {
|
||||
|
||||
private MockMvc mockMvc;
|
||||
private static final String CONTENT_TYPE = "application/json;charset=UTF-8";
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
|
@ -25,7 +23,7 @@ public class SimpleBookControllerIntegrationTest {
|
|||
this.mockMvc
|
||||
.perform(get("/books/42"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType(CONTENT_TYPE))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
|
||||
.andExpect(jsonPath("$.id").value(42));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
package com.baeldung.web.controller;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
public class SimpleBookRestControllerIntegrationTest {
|
||||
|
||||
private MockMvc mockMvc;
|
||||
private static final String CONTENT_TYPE = "application/json;charset=UTF-8";
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
|
@ -25,7 +23,7 @@ public class SimpleBookRestControllerIntegrationTest {
|
|||
this.mockMvc
|
||||
.perform(get("/books-rest/42"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType(CONTENT_TYPE))
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
|
||||
.andExpect(jsonPath("$.id").value(42));
|
||||
}
|
||||
|
||||
|
|
|
@ -215,6 +215,8 @@
|
|||
<rest-assured-json-schema-validator.version>3.0.1</rest-assured-json-schema-validator.version>
|
||||
|
||||
<scribejava.version>2.5.3</scribejava.version>
|
||||
|
||||
<spring-boot.version>2.1.9.RELEASE</spring-boot.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
Loading…
Reference in New Issue