Merge branch 'master' of https://github.com/eugenp/tutorials into task/BAEL-20665
# Conflicts: # core-java-modules/core-java-jndi/pom.xml
This commit is contained in:
@@ -64,7 +64,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
<artifactId>cobertura-maven-plugin</artifactId>
|
||||||
<version>2.7</version>
|
<version>${cobertura.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<instrumentation>
|
<instrumentation>
|
||||||
<ignores>
|
<ignores>
|
||||||
@@ -85,6 +85,7 @@
|
|||||||
<commons-codec.version>1.11</commons-codec.version>
|
<commons-codec.version>1.11</commons-codec.version>
|
||||||
<guava.version>27.0.1-jre</guava.version>
|
<guava.version>27.0.1-jre</guava.version>
|
||||||
<combinatoricslib3.version>3.3.0</combinatoricslib3.version>
|
<combinatoricslib3.version>3.3.0</combinatoricslib3.version>
|
||||||
|
<cobertura.plugin.version>2.7</cobertura.plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -46,13 +46,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>${commons.lang3.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>pl.pragmatists</groupId>
|
<groupId>pl.pragmatists</groupId>
|
||||||
<artifactId>JUnitParams</artifactId>
|
<artifactId>JUnitParams</artifactId>
|
||||||
<version>1.1.0</version>
|
<version>${JUnitParams.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -91,6 +91,8 @@
|
|||||||
<retrofit.version>2.6.0</retrofit.version>
|
<retrofit.version>2.6.0</retrofit.version>
|
||||||
<jmh-core.version>1.19</jmh-core.version>
|
<jmh-core.version>1.19</jmh-core.version>
|
||||||
<jmh-generator.version>1.19</jmh-generator.version>
|
<jmh-generator.version>1.19</jmh-generator.version>
|
||||||
|
<commons.lang3.version>3.8.1</commons.lang3.version>
|
||||||
|
<JUnitParams.version>1.1.0</JUnitParams.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>28.1-jre</version>
|
<version>${guava.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -65,6 +65,7 @@
|
|||||||
<org.assertj.core.version>3.9.0</org.assertj.core.version>
|
<org.assertj.core.version>3.9.0</org.assertj.core.version>
|
||||||
<commons-codec.version>1.11</commons-codec.version>
|
<commons-codec.version>1.11</commons-codec.version>
|
||||||
<commons-math3.version>3.6.1</commons-math3.version>
|
<commons-math3.version>3.6.1</commons-math3.version>
|
||||||
|
<guava.version>28.1-jre</guava.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -18,19 +18,19 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.ws.rs</groupId>
|
<groupId>javax.ws.rs</groupId>
|
||||||
<artifactId>javax.ws.rs-api</artifactId>
|
<artifactId>javax.ws.rs-api</artifactId>
|
||||||
<version>2.1</version>
|
<version>${rs-api.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.enterprise</groupId>
|
<groupId>javax.enterprise</groupId>
|
||||||
<artifactId>cdi-api</artifactId>
|
<artifactId>cdi-api</artifactId>
|
||||||
<version>2.0</version>
|
<version>${cdi-api.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.json.bind</groupId>
|
<groupId>javax.json.bind</groupId>
|
||||||
<artifactId>javax.json.bind-api</artifactId>
|
<artifactId>javax.json.bind-api</artifactId>
|
||||||
<version>1.0</version>
|
<version>${bind-api.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -80,6 +80,9 @@
|
|||||||
<liberty-maven-plugin.version>2.4.2</liberty-maven-plugin.version>
|
<liberty-maven-plugin.version>2.4.2</liberty-maven-plugin.version>
|
||||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||||
<openliberty-version>18.0.0.2</openliberty-version>
|
<openliberty-version>18.0.0.2</openliberty-version>
|
||||||
|
<rs-api.version>2.1</rs-api.version>
|
||||||
|
<cdi-api.version>2.0</cdi-api.version>
|
||||||
|
<bind-api.version>1.0</bind-api.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -17,11 +17,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.rocketmq</groupId>
|
<groupId>org.apache.rocketmq</groupId>
|
||||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||||
<version>2.0.4</version>
|
<version>${rocketmq.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<geode.core>1.6.0</geode.core>
|
<geode.core>1.6.0</geode.core>
|
||||||
|
<rocketmq.version>2.0.4</rocketmq.version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
+10
-5
@@ -81,10 +81,10 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>${compiler.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>${source.version}</source>
|
||||||
<target>1.8</target>
|
<target>${target.version}</target>
|
||||||
<optimize>true</optimize>
|
<optimize>true</optimize>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
@@ -92,7 +92,7 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.7.2</version>
|
<version>${compiler.surefire.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<systemPropertyVariables>
|
<systemPropertyVariables>
|
||||||
<tapestry.execution-mode>Qa</tapestry.execution-mode>
|
<tapestry.execution-mode>Qa</tapestry.execution-mode>
|
||||||
@@ -104,7 +104,7 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.mortbay.jetty</groupId>
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
<artifactId>maven-jetty-plugin</artifactId>
|
<artifactId>maven-jetty-plugin</artifactId>
|
||||||
<version>6.1.16</version>
|
<version>${compiler.jetty.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!-- Log to the console. -->
|
<!-- Log to the console. -->
|
||||||
<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
|
<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
|
||||||
@@ -140,6 +140,11 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's
|
|||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<compiler.jetty.version>6.1.16</compiler.jetty.version>
|
||||||
|
<compiler.surefire.version>2.7.2</compiler.surefire.version>
|
||||||
|
<compiler.plugin.version>2.3.2</compiler.plugin.version>
|
||||||
|
<source.version>1.8</source.version>
|
||||||
|
<target.version>1.8</target.version>
|
||||||
<tapestry-release-version>5.4.5</tapestry-release-version>
|
<tapestry-release-version>5.4.5</tapestry-release-version>
|
||||||
<servlet-api-release-version>2.5</servlet-api-release-version>
|
<servlet-api-release-version>2.5</servlet-api-release-version>
|
||||||
<testng-release-version>6.8.21</testng-release-version>
|
<testng-release-version>6.8.21</testng-release-version>
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
<spring.version>2.2.1.RELEASE</spring.version>
|
||||||
|
<awssdk.version>2.10.27</awssdk.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@@ -26,7 +28,7 @@
|
|||||||
<!-- Import dependency management from Spring Boot -->
|
<!-- Import dependency management from Spring Boot -->
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
<version>2.2.1.RELEASE</version>
|
<version>${spring.version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>software.amazon.awssdk</groupId>
|
<groupId>software.amazon.awssdk</groupId>
|
||||||
<artifactId>bom</artifactId>
|
<artifactId>bom</artifactId>
|
||||||
<version>2.10.27</version>
|
<version>${awssdk.version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
+2
-1
@@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>${assembly.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<finalName>${project.build.finalName}</finalName>
|
<finalName>${project.build.finalName}</finalName>
|
||||||
<appendAssemblyId>false</appendAssemblyId>
|
<appendAssemblyId>false</appendAssemblyId>
|
||||||
@@ -161,6 +161,7 @@
|
|||||||
<assertj-core.version>3.11.1</assertj-core.version>
|
<assertj-core.version>3.11.1</assertj-core.version>
|
||||||
<maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version>
|
<maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version>
|
||||||
<process-exec-maven-plugin.version>0.7</process-exec-maven-plugin.version>
|
<process-exec-maven-plugin.version>0.7</process-exec-maven-plugin.version>
|
||||||
|
<assembly.plugin.version>3.1.0</assembly.plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -62,12 +62,12 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.groovy</groupId>
|
<groupId>org.codehaus.groovy</groupId>
|
||||||
<artifactId>groovy-eclipse-compiler</artifactId>
|
<artifactId>groovy-eclipse-compiler</artifactId>
|
||||||
<version>3.3.0-01</version>
|
<version>${groovy.compiler.version}</version>
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>${compiler.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<compilerId>groovy-eclipse-compiler</compilerId>
|
<compilerId>groovy-eclipse-compiler</compilerId>
|
||||||
<source>${java.version}</source>
|
<source>${java.version}</source>
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.20.1</version>
|
<version>${surefire.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<useFile>false</useFile>
|
<useFile>false</useFile>
|
||||||
<includes>
|
<includes>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>${assembly.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!-- get all project dependencies -->
|
<!-- get all project dependencies -->
|
||||||
<descriptorRefs>
|
<descriptorRefs>
|
||||||
@@ -183,6 +183,10 @@
|
|||||||
<groovy-wslite.version>1.1.3</groovy-wslite.version>
|
<groovy-wslite.version>1.1.3</groovy-wslite.version>
|
||||||
<logback.version>1.2.3</logback.version>
|
<logback.version>1.2.3</logback.version>
|
||||||
<groovy.version>2.5.7</groovy.version>
|
<groovy.version>2.5.7</groovy.version>
|
||||||
|
<assembly.plugin.version>3.1.0</assembly.plugin.version>
|
||||||
|
<surefire.plugin.version>2.20.1</surefire.plugin.version>
|
||||||
|
<compiler.plugin.version>3.8.0</compiler.plugin.version>
|
||||||
|
<groovy.compiler.version>3.3.0-01</groovy.compiler.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -99,7 +99,7 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.20.1</version>
|
<version>${surefire.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<useFile>false</useFile>
|
<useFile>false</useFile>
|
||||||
<includes>
|
<includes>
|
||||||
@@ -126,6 +126,7 @@
|
|||||||
<hsqldb.version>2.4.0</hsqldb.version>
|
<hsqldb.version>2.4.0</hsqldb.version>
|
||||||
<spock-core.version>1.1-groovy-2.4</spock-core.version>
|
<spock-core.version>1.1-groovy-2.4</spock-core.version>
|
||||||
<gmavenplus-plugin.version>1.6</gmavenplus-plugin.version>
|
<gmavenplus-plugin.version>1.6</gmavenplus-plugin.version>
|
||||||
|
<surefire.plugin.version>2.20.1</surefire.plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -42,12 +42,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.collections</groupId>
|
<groupId>org.eclipse.collections</groupId>
|
||||||
<artifactId>eclipse-collections</artifactId>
|
<artifactId>eclipse-collections</artifactId>
|
||||||
<version>10.0.0</version>
|
<version>${eclipse.collections.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.collections</groupId>
|
<groupId>org.eclipse.collections</groupId>
|
||||||
<artifactId>eclipse-collections-api</artifactId>
|
<artifactId>eclipse-collections-api</artifactId>
|
||||||
<version>10.0.0</version>
|
<version>${eclipse.collections.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@@ -108,6 +108,7 @@
|
|||||||
<assertj.version>3.11.1</assertj.version>
|
<assertj.version>3.11.1</assertj.version>
|
||||||
<uberjar.name>benchmarks</uberjar.name>
|
<uberjar.name>benchmarks</uberjar.name>
|
||||||
<jmh.version>1.22</jmh.version>
|
<jmh.version>1.22</jmh.version>
|
||||||
|
<eclipse.collections.version>10.0.0</eclipse.collections.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.0.0-M3</version>
|
<version>${surefire.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<argLine>--enable-preview</argLine>
|
<argLine>--enable-preview</argLine>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -53,6 +53,7 @@
|
|||||||
<maven.compiler.source.version>13</maven.compiler.source.version>
|
<maven.compiler.source.version>13</maven.compiler.source.version>
|
||||||
<maven.compiler.target.version>13</maven.compiler.target.version>
|
<maven.compiler.target.version>13</maven.compiler.target.version>
|
||||||
<assertj.version>3.6.1</assertj.version>
|
<assertj.version>3.6.1</assertj.version>
|
||||||
|
<surefire.plugin.version>3.0.0-M3</surefire.plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package com.baeldung.newfeatures;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class SwitchExpressionsWithYieldUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("preview")
|
||||||
|
public void whenSwitchingOnOperationSquareMe_thenWillReturnSquare() {
|
||||||
|
var me = 4;
|
||||||
|
var operation = "squareMe";
|
||||||
|
var result = switch (operation) {
|
||||||
|
case "doubleMe" -> {
|
||||||
|
yield me * 2;
|
||||||
|
}
|
||||||
|
case "squareMe" -> {
|
||||||
|
yield me * me;
|
||||||
|
}
|
||||||
|
default -> me;
|
||||||
|
};
|
||||||
|
|
||||||
|
assertEquals(16, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
package com.baeldung.newfeatures;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class TextBlocksUnitTest {
|
||||||
|
|
||||||
|
private static final String JSON_STRING = "{\r\n" + "\"name\" : \"Baeldung\",\r\n" + "\"website\" : \"https://www.%s.com/\"\r\n" + "}";
|
||||||
|
|
||||||
|
@SuppressWarnings("preview")
|
||||||
|
private static final String TEXT_BLOCK_JSON = """
|
||||||
|
{
|
||||||
|
"name" : "Baeldung",
|
||||||
|
"website" : "https://www.%s.com/"
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenTextBlocks_thenStringOperationsWork() {
|
||||||
|
|
||||||
|
assertThat(TEXT_BLOCK_JSON.contains("Baeldung")).isTrue();
|
||||||
|
assertThat(TEXT_BLOCK_JSON.indexOf("www")).isGreaterThan(0);
|
||||||
|
assertThat(TEXT_BLOCK_JSON.length()).isGreaterThan(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("removal")
|
||||||
|
@Test
|
||||||
|
public void whenTextBlocks_thenFormattedWorksAsFormat() {
|
||||||
|
assertThat(TEXT_BLOCK_JSON.formatted("baeldung")
|
||||||
|
.contains("www.baeldung.com")).isTrue();
|
||||||
|
|
||||||
|
assertThat(String.format(JSON_STRING, "baeldung")
|
||||||
|
.contains("www.baeldung.com")).isTrue();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.0.0-M3</version>
|
<version>${surefire.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<argLine>--enable-preview</argLine>
|
<argLine>--enable-preview</argLine>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source.version>14</maven.compiler.source.version>
|
<maven.compiler.source.version>14</maven.compiler.source.version>
|
||||||
<maven.compiler.target.version>14</maven.compiler.target.version>
|
<maven.compiler.target.version>14</maven.compiler.target.version>
|
||||||
|
<surefire.plugin.version>3.0.0-M3</surefire.plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>${shade.plugin.version}</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
@@ -79,6 +79,7 @@
|
|||||||
<commons-lang3.version>3.9</commons-lang3.version>
|
<commons-lang3.version>3.9</commons-lang3.version>
|
||||||
<!-- testing -->
|
<!-- testing -->
|
||||||
<assertj-core.version>3.10.0</assertj-core.version>
|
<assertj-core.version>3.10.0</assertj-core.version>
|
||||||
|
<shade.plugin.version>3.2.0</shade.plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -183,8 +183,8 @@
|
|||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>${maven-javadoc-plugin.version}</version>
|
<version>${maven-javadoc-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>${source.version}</source>
|
||||||
<target>1.8</target>
|
<target>${target.version}</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
@@ -373,6 +373,8 @@
|
|||||||
<maven-shade-plugin.version>3.1.1</maven-shade-plugin.version>
|
<maven-shade-plugin.version>3.1.1</maven-shade-plugin.version>
|
||||||
<spring-boot-maven-plugin.version>2.0.3.RELEASE</spring-boot-maven-plugin.version>
|
<spring-boot-maven-plugin.version>2.0.3.RELEASE</spring-boot-maven-plugin.version>
|
||||||
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
|
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
|
||||||
|
<source.version>1.8</source.version>
|
||||||
|
<target.version>1.8</target.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -207,8 +207,8 @@
|
|||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>${maven-javadoc-plugin.version}</version>
|
<version>${maven-javadoc-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>${source.version}</source>
|
||||||
<target>1.8</target>
|
<target>${target.version}</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
@@ -397,6 +397,8 @@
|
|||||||
<maven-shade-plugin.version>3.1.1</maven-shade-plugin.version>
|
<maven-shade-plugin.version>3.1.1</maven-shade-plugin.version>
|
||||||
<spring-boot-maven-plugin.version>2.0.3.RELEASE</spring-boot-maven-plugin.version>
|
<spring-boot-maven-plugin.version>2.0.3.RELEASE</spring-boot-maven-plugin.version>
|
||||||
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
|
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
|
||||||
|
<source.version>1.8</source.version>
|
||||||
|
<target.version>1.8</target.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
<version>5.5.1</version>
|
<version>${jupiter.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -30,29 +30,50 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-core</artifactId>
|
<artifactId>spring-core</artifactId>
|
||||||
<version>5.0.9.RELEASE</version>
|
<version>${spring.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context</artifactId>
|
<artifactId>spring-context</artifactId>
|
||||||
<version>5.0.9.RELEASE</version>
|
<version>${spring.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-jdbc</artifactId>
|
<artifactId>spring-jdbc</artifactId>
|
||||||
<version>5.0.9.RELEASE</version>
|
<version>${spring.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-test</artifactId>
|
<artifactId>spring-test</artifactId>
|
||||||
<version>5.0.9.RELEASE</version>
|
<version>${spring.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<version>1.4.199</version>
|
<version>${h2.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>${source.version}</source>
|
||||||
|
<target>${target.version}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<spring.version>5.0.9.RELEASE</spring.version>
|
||||||
|
<h2.version>1.4.199</h2.version>
|
||||||
|
<jupiter.version>5.5.1</jupiter.version>
|
||||||
|
<source.version>1.8</source.version>
|
||||||
|
<target.version>1.8</target.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baeldung.servicemodule</groupId>
|
<groupId>com.baeldung.servicemodule</groupId>
|
||||||
<artifactId>servicemodule</artifactId>
|
<artifactId>servicemodule</artifactId>
|
||||||
<version>1.0</version>
|
<version>${servicemodule.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@@ -29,4 +29,8 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<servicemodule.version>1.0</servicemodule.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -19,10 +19,10 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>${compiler.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>11</source>
|
<source>${source.version}</source>
|
||||||
<target>11</target>
|
<target>${target.version}</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
@@ -31,6 +31,9 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<compiler.plugin.version>3.8.0</compiler.plugin.version>
|
||||||
|
<source.version>11</source.version>
|
||||||
|
<target.version>11</target.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -17,12 +17,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baeldung.servicemodule</groupId>
|
<groupId>com.baeldung.servicemodule</groupId>
|
||||||
<artifactId>servicemodule</artifactId>
|
<artifactId>servicemodule</artifactId>
|
||||||
<version>1.0</version>
|
<version>${servicemodule.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baeldung.providermodule</groupId>
|
<groupId>com.baeldung.providermodule</groupId>
|
||||||
<artifactId>providermodule</artifactId>
|
<artifactId>providermodule</artifactId>
|
||||||
<version>1.0</version>
|
<version>${providermodule.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@@ -34,5 +34,10 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<servicemodule.version>1.0</servicemodule.version>
|
||||||
|
<providermodule.version>1.0</providermodule.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -20,14 +20,20 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.8.0</version>
|
<version>${compiler.plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>11</source>
|
<source>${source.version}</source>
|
||||||
<target>11</target>
|
<target>${target.version}</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<compiler.plugin.version>3.8.0</compiler.plugin.version>
|
||||||
|
<source.version>11</source.version>
|
||||||
|
<target.version>11</target.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baeldung.servicemodule</groupId>
|
<groupId>com.baeldung.servicemodule</groupId>
|
||||||
<artifactId>servicemodule</artifactId>
|
<artifactId>servicemodule</artifactId>
|
||||||
<version>1.0</version>
|
<version>${servicemodule.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@@ -30,4 +30,9 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<servicemodule.version>1.0</servicemodule.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-beanutils</groupId>
|
<groupId>commons-beanutils</groupId>
|
||||||
<artifactId>commons-beanutils</artifactId>
|
<artifactId>commons-beanutils</artifactId>
|
||||||
<version>1.9.4</version>
|
<version>${commons.beanutils.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openjdk.jmh</groupId>
|
<groupId>org.openjdk.jmh</groupId>
|
||||||
@@ -57,6 +57,7 @@
|
|||||||
<jmh-core.version>1.19</jmh-core.version>
|
<jmh-core.version>1.19</jmh-core.version>
|
||||||
<jmh-generator.version>1.19</jmh-generator.version>
|
<jmh-generator.version>1.19</jmh-generator.version>
|
||||||
<assertj.version>3.12.2</assertj.version>
|
<assertj.version>3.12.2</assertj.version>
|
||||||
|
<commons.beanutils.version>1.9.4</commons.beanutils.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
+36
-1
@@ -1,6 +1,8 @@
|
|||||||
package com.baeldung.optional;
|
package com.baeldung.optional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Person {
|
public class Person {
|
||||||
private String name;
|
private String name;
|
||||||
@@ -21,7 +23,7 @@ public class Person {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Integer> getAge() {
|
public Optional<Integer> getAge() {
|
||||||
return Optional.ofNullable(age);
|
return Optional.of(age);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAge(int age) {
|
public void setAge(int age) {
|
||||||
@@ -36,4 +38,37 @@ public class Person {
|
|||||||
return Optional.ofNullable(password);
|
return Optional.ofNullable(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<Person> search(List<Person> people, String name, Optional<Integer> age) {
|
||||||
|
// Null checks for people and name
|
||||||
|
return people.stream()
|
||||||
|
.filter(p -> p.getName().equals(name))
|
||||||
|
.filter(p -> p.getAge().get() >= age.orElse(0))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Person> search(List<Person> people, String name, Integer age) {
|
||||||
|
// Null checks for people and name
|
||||||
|
final Integer ageFilter = age != null ? age : 0;
|
||||||
|
|
||||||
|
return people.stream()
|
||||||
|
.filter(p -> p.getName().equals(name))
|
||||||
|
.filter(p -> p.getAge().get() >= ageFilter)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Person> search(List<Person> people, String name) {
|
||||||
|
return doSearch(people, name, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Person> search(List<Person> people, String name, int age) {
|
||||||
|
return doSearch(people, name, age);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<Person> doSearch(List<Person> people, String name, int age) {
|
||||||
|
// Null checks for people and name
|
||||||
|
return people.stream()
|
||||||
|
.filter(p -> p.getName().equals(name))
|
||||||
|
.filter(p -> p.getAge().get().intValue() >= age)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>${maven-compiler-plugin.version}</version>
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>${source.version}</source>
|
||||||
<target>1.8</target>
|
<target>${target.version}</target>
|
||||||
<compilerArgument>-parameters</compilerArgument>
|
<compilerArgument>-parameters</compilerArgument>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
@@ -48,5 +48,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
|
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
|
||||||
<assertj-core.version>3.10.0</assertj-core.version>
|
<assertj-core.version>3.10.0</assertj-core.version>
|
||||||
|
<source.version>1.8</source.version>
|
||||||
|
<target.version>1.8</target.version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package com.baeldung.reflection.exception.invocationtarget;
|
||||||
|
|
||||||
|
public class InvocationTargetExample {
|
||||||
|
public int divideByZeroExample() {
|
||||||
|
return 1 / 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package com.baeldung.reflection.exception.invocationtarget;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class InvocationTargetUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCallingMethodThrowsException_thenAssertCauseOfInvocationTargetException() throws Exception {
|
||||||
|
|
||||||
|
InvocationTargetExample targetExample = new InvocationTargetExample();
|
||||||
|
Method method = InvocationTargetExample.class.getMethod("divideByZeroExample");
|
||||||
|
|
||||||
|
Exception exception = assertThrows(InvocationTargetException.class, () -> method.invoke(targetExample));
|
||||||
|
|
||||||
|
assertEquals(ArithmeticException.class, exception.getCause().getClass());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>28.1-jre</version>
|
<version>${guava.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<commons-lang3.version>3.8.1</commons-lang3.version>
|
<commons-lang3.version>3.8.1</commons-lang3.version>
|
||||||
<assertj.version>3.6.1</assertj.version>
|
<assertj.version>3.6.1</assertj.version>
|
||||||
<guava.version>27.0.1-jre</guava.version>
|
<guava.version>28.1-jre</guava.version>
|
||||||
<junit-jupiter-api.version>5.3.1</junit-jupiter-api.version>
|
<junit-jupiter-api.version>5.3.1</junit-jupiter-api.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user