From c36156418a89496856bfacf02ca2a0cca2a4aa0f Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sun, 10 Jun 2018 21:52:09 +0200 Subject: [PATCH 01/18] added article link --- core-java-9/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-9/README.md b/core-java-9/README.md index 4223e57d4b..a76dcefc69 100644 --- a/core-java-9/README.md +++ b/core-java-9/README.md @@ -25,3 +25,4 @@ - [Introduction to Chronicle Queue](http://www.baeldung.com/java-chronicle-queue) - [A Guide to Java 9 Modularity](http://www.baeldung.com/java-9-modularity) - [Optional orElse Optional](http://www.baeldung.com/java-optional-or-else-optional) +- [Java 9 java.lang.Module API](http://www.baeldung.com/java-9-module-api) From 3d602e63988f8d90083ef279ae71ecd705b9bf52 Mon Sep 17 00:00:00 2001 From: Timoteo Ponce Date: Mon, 11 Jun 2018 09:48:24 -0400 Subject: [PATCH 02/18] Added error handling policies for javax-servlets module --- .../servlets/ErrorHandlerServlet.java | 34 +++++++++++++++++++ .../baeldung/servlets/RandomErrorServlet.java | 13 +++++++ .../src/main/webapp/WEB-INF/web.xml | 16 +++++++++ javax-servlets/src/main/webapp/error-404.html | 14 ++++++++ spring-boot-ops/README.MD | 3 -- 5 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 javax-servlets/src/main/java/com/baeldung/servlets/ErrorHandlerServlet.java create mode 100644 javax-servlets/src/main/java/com/baeldung/servlets/RandomErrorServlet.java create mode 100644 javax-servlets/src/main/webapp/WEB-INF/web.xml create mode 100644 javax-servlets/src/main/webapp/error-404.html delete mode 100644 spring-boot-ops/README.MD diff --git a/javax-servlets/src/main/java/com/baeldung/servlets/ErrorHandlerServlet.java b/javax-servlets/src/main/java/com/baeldung/servlets/ErrorHandlerServlet.java new file mode 100644 index 0000000000..0008e837c0 --- /dev/null +++ b/javax-servlets/src/main/java/com/baeldung/servlets/ErrorHandlerServlet.java @@ -0,0 +1,34 @@ +package com.baeldung.servlets; + +import javax.servlet.annotation.*; +import javax.servlet.http.*; +import java.io.*; +import java.util.*; + +import static javax.servlet.RequestDispatcher.*; + +@WebServlet(urlPatterns = "/errorHandler") +public class ErrorHandlerServlet extends HttpServlet { + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) + throws IOException { + resp.setContentType("text/html; charset=utf-8"); + try (PrintWriter writer = resp.getWriter()) { + writer.write("Error description"); + writer.write("

Error description

"); + writer.write(""); + writer.write(""); + } + + Exception exception = (Exception) req.getAttribute(ERROR_EXCEPTION); + if (IllegalArgumentException.class.isInstance(exception)) { + getServletContext().log("Error on an application argument", exception); + } + } +} \ No newline at end of file diff --git a/javax-servlets/src/main/java/com/baeldung/servlets/RandomErrorServlet.java b/javax-servlets/src/main/java/com/baeldung/servlets/RandomErrorServlet.java new file mode 100644 index 0000000000..c95bd2cec0 --- /dev/null +++ b/javax-servlets/src/main/java/com/baeldung/servlets/RandomErrorServlet.java @@ -0,0 +1,13 @@ +package com.baeldung.servlets; + +import javax.servlet.annotation.*; +import javax.servlet.http.*; + +@WebServlet(urlPatterns = "/randomError") +public class RandomErrorServlet extends HttpServlet { + + @Override + protected void doGet(HttpServletRequest req, final HttpServletResponse resp) { + throw new IllegalStateException("Random error"); + } +} \ No newline at end of file diff --git a/javax-servlets/src/main/webapp/WEB-INF/web.xml b/javax-servlets/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..c9a06ac52d --- /dev/null +++ b/javax-servlets/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,16 @@ + + + + 404 + /error-404.html + + + + java.lang.Exception + /errorHandler + + \ No newline at end of file diff --git a/javax-servlets/src/main/webapp/error-404.html b/javax-servlets/src/main/webapp/error-404.html new file mode 100644 index 0000000000..b36fc44160 --- /dev/null +++ b/javax-servlets/src/main/webapp/error-404.html @@ -0,0 +1,14 @@ + + + + + Error page + + + +

Error: Page not found

+ +Go back home + + + \ No newline at end of file diff --git a/spring-boot-ops/README.MD b/spring-boot-ops/README.MD deleted file mode 100644 index 26caccb727..0000000000 --- a/spring-boot-ops/README.MD +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: - -- [Deploy a Spring Boot WAR into a Tomcat Server](http://www.baeldung.com/spring-boot-war-tomcat-deploy) From 86fe6cfb56b108a3c93c017b4ed2166a372a5753 Mon Sep 17 00:00:00 2001 From: Syed Mansoor Date: Sun, 17 Jun 2018 16:52:56 +1000 Subject: [PATCH 03/18] [BAEL-1753] Simpl application with Ktor --- kotlin-ktor/.gitignore | 13 ++ kotlin-ktor/build.gradle | 47 +++++ kotlin-ktor/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + kotlin-ktor/gradlew | 172 ++++++++++++++++++ kotlin-ktor/gradlew.bat | 84 +++++++++ .../META-INF/KtorExample_main.kotlin_module | Bin 0 -> 31 bytes kotlin-ktor/resources/application.conf | 5 + kotlin-ktor/resources/logback.xml | 11 ++ kotlin-ktor/settings.gradle | 2 + kotlin-ktor/src/main/kotlin/APIServer.kt | 50 +++++ kotlin-ktor/webapp/WEB-INF/web.xml | 35 ++++ 12 files changed, 424 insertions(+) create mode 100644 kotlin-ktor/.gitignore create mode 100755 kotlin-ktor/build.gradle create mode 100755 kotlin-ktor/gradle/wrapper/gradle-wrapper.jar create mode 100755 kotlin-ktor/gradle/wrapper/gradle-wrapper.properties create mode 100755 kotlin-ktor/gradlew create mode 100755 kotlin-ktor/gradlew.bat create mode 100644 kotlin-ktor/out/production/classes/META-INF/KtorExample_main.kotlin_module create mode 100755 kotlin-ktor/resources/application.conf create mode 100755 kotlin-ktor/resources/logback.xml create mode 100755 kotlin-ktor/settings.gradle create mode 100755 kotlin-ktor/src/main/kotlin/APIServer.kt create mode 100755 kotlin-ktor/webapp/WEB-INF/web.xml diff --git a/kotlin-ktor/.gitignore b/kotlin-ktor/.gitignore new file mode 100644 index 0000000000..1db5e66882 --- /dev/null +++ b/kotlin-ktor/.gitignore @@ -0,0 +1,13 @@ +/bin/ + +#ignore gradle +.gradle/ + + +#ignore build and generated files +build/ +node/ + +#ignore installed node modules and package lock file +node_modules/ +package-lock.json diff --git a/kotlin-ktor/build.gradle b/kotlin-ktor/build.gradle new file mode 100755 index 0000000000..95c993b923 --- /dev/null +++ b/kotlin-ktor/build.gradle @@ -0,0 +1,47 @@ + + +group 'com.baeldung.ktor' +version '1.0-SNAPSHOT' + + +buildscript { + ext.kotlin_version = '1.2.40' + ext.ktor_version = '0.9.2' + + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'java' +apply plugin: 'kotlin' +apply plugin: 'application' + +mainClassName = 'APIServer.kt' + +sourceCompatibility = 1.8 +compileKotlin { kotlinOptions.jvmTarget = "1.8" } +compileTestKotlin { kotlinOptions.jvmTarget = "1.8" } + +kotlin { experimental { coroutines "enable" } } + +repositories { + mavenCentral() + jcenter() + maven { url "https://dl.bintray.com/kotlin/ktor" } +} + +dependencies { + compile "io.ktor:ktor-server-netty:$ktor_version" + compile "ch.qos.logback:logback-classic:1.2.1" + compile "com.google.code.gson:gson:2.8.1" + testCompile group: 'junit', name: 'junit', version: '4.12' + +} +task runServer(type: JavaExec) { + main = 'APIServer' + classpath = sourceSets.main.runtimeClasspath +} \ No newline at end of file diff --git a/kotlin-ktor/gradle/wrapper/gradle-wrapper.jar b/kotlin-ktor/gradle/wrapper/gradle-wrapper.jar new file mode 100755 index 0000000000000000000000000000000000000000..01b8bf6b1f99cad9213fc495b33ad5bbab8efd20 GIT binary patch literal 54329 zcmagFV|ZrKvM!pAZQHhO+qP}9lTNj?q^^Y^VFp)SH8qbSJ)2BQ2giqeFT zAwqu@)c?v~^Z#E_K}1nTQbJ9gQ9<%vVRAxVj)8FwL5_iTdUB>&m3fhE=kRWl;g`&m z!W5kh{WsV%fO*%je&j+Lv4xxK~zsEYQls$Q-p&dwID|A)!7uWtJF-=Tm1{V@#x*+kUI$=%KUuf2ka zjiZ{oiL1MXE2EjciJM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3 zk$(aNj2kYlyp9eg0Cite{bxChmkiMtuw(CkDy9OY{&D}pkOpXIL^z{~#&0%1E{ zK>kKWfRLbwwWXniwY9mU&99s0sLU*`5Fi`R0H`V1bHxF7)Oh~@{qLkxKW*>VxO>Mc z_9Xz6CBOv$`cuIK{DNOpS@b_v_iMb2Qk2^-fHr0VWM=p)9vIcH@vQ6}bS*6Yn+<0` zHS-Vv-qdTr#{}n3wF3e|XZ$C;U)Qd{m8L}r&_O_ewZqTP@pJJM`6Zf!wef%L?Uz~3 zpTS_ne+l+mInQ6()XNOo&n#$?|C{C4&G0hQ=rg7e;4A)%PJcP|_)Ff=moW%6^ug z8A_gu6#(#0?fWxw=jFpM^OZb5obmUE|C2J}zt06c~G6javMT=uh?kFRJn{;a>`(Kf~)={S*9)sq#zMmpb6ju-(@G1p8+%!%NJUqO#AJ zLyrH1`9}=EfBQ1Nly7}TZE*Sx)c-E#`m*{jB`KeY#NB?E=#S?4w?O4ff|v4t&jdW4 zzd`U1Vt_B1UW$Z0Gx_`c2GegzhP~u`sr&TIN$CF@od2W(^^)qPP{uQrcGz!F{ex`A zOQx5i1kX&Gk-x$8hdJ>6Qlj7`)yr7$XDZp4-=+e5Uu^!Y>-Li5WoYd)iE;dIll<|% z{z+`)CCkeg&Sw^b#NTH5b42G$f|v1g&jg|=|DOc^tHoYMG(A({rT+%i|7@$5p)Jq& zu9?4q|IdLgFWc>9B)~ISBVax9V!-~>SoO!R`1K^~<^J \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/kotlin-ktor/gradlew.bat b/kotlin-ktor/gradlew.bat new file mode 100755 index 0000000000..e95643d6a2 --- /dev/null +++ b/kotlin-ktor/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/kotlin-ktor/out/production/classes/META-INF/KtorExample_main.kotlin_module b/kotlin-ktor/out/production/classes/META-INF/KtorExample_main.kotlin_module new file mode 100644 index 0000000000000000000000000000000000000000..3a457da8fc1f80c3d62dad3e91da31eaeadc7597 GIT binary patch literal 31 gcmZQzU|?ooU|@t|E-qd!1|d$z0MFpmqO#N?024+7od5s; literal 0 HcmV?d00001 diff --git a/kotlin-ktor/resources/application.conf b/kotlin-ktor/resources/application.conf new file mode 100755 index 0000000000..111af5304c --- /dev/null +++ b/kotlin-ktor/resources/application.conf @@ -0,0 +1,5 @@ +ktor { + application { + modules = [ io.ktor.samples.HelloKt.main ] + } +} \ No newline at end of file diff --git a/kotlin-ktor/resources/logback.xml b/kotlin-ktor/resources/logback.xml new file mode 100755 index 0000000000..274cdcdb02 --- /dev/null +++ b/kotlin-ktor/resources/logback.xml @@ -0,0 +1,11 @@ + + + + %d{YYYY-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + \ No newline at end of file diff --git a/kotlin-ktor/settings.gradle b/kotlin-ktor/settings.gradle new file mode 100755 index 0000000000..13bbce9583 --- /dev/null +++ b/kotlin-ktor/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'KtorWithKotlin' + diff --git a/kotlin-ktor/src/main/kotlin/APIServer.kt b/kotlin-ktor/src/main/kotlin/APIServer.kt new file mode 100755 index 0000000000..3aa1fa96f9 --- /dev/null +++ b/kotlin-ktor/src/main/kotlin/APIServer.kt @@ -0,0 +1,50 @@ +@file:JvmName("APIServer") + +import com.google.gson.Gson +import io.ktor.application.call +import io.ktor.application.install +import io.ktor.features.CallLogging +import io.ktor.features.DefaultHeaders +import io.ktor.http.ContentType +import io.ktor.request.path +import io.ktor.response.respondText +import io.ktor.routing.get +import io.ktor.routing.routing +import io.ktor.server.engine.embeddedServer +import io.ktor.server.netty.Netty +import org.slf4j.event.Level + +fun main(args: Array) { + + val jsonResponse = """{ + "id": 1, + "task": "Pay waterbill", + "description": "Pay water bill today", + }""" + + data class Author(val name: String, val website: String) + + embeddedServer(Netty, 8080) { + install(DefaultHeaders) { + header("X-Developer", "Baeldung") + } + install(CallLogging) { + level = Level.INFO + filter { call -> call.request.path().startsWith("/todo") } + filter { call -> call.request.path().startsWith("/author") } + } + routing { + get("/todo") { + call.respondText(jsonResponse, ContentType.Application.Json) + } + get("/author") { + val author = Author("baeldung", "baeldung.com") + val gson = Gson() + val json = gson.toJson(author) + call.respondText(json, ContentType.Application.Json) + + } + + } + }.start(wait = true) +} \ No newline at end of file diff --git a/kotlin-ktor/webapp/WEB-INF/web.xml b/kotlin-ktor/webapp/WEB-INF/web.xml new file mode 100755 index 0000000000..513a80cb27 --- /dev/null +++ b/kotlin-ktor/webapp/WEB-INF/web.xml @@ -0,0 +1,35 @@ + + + + + + + io.ktor.ktor.config + application.conf + + + + KtorServlet + KtorServlet + io.ktor.server.servlet.ServletApplicationEngine + + + true + + + + 304857600 + 304857600 + 0 + + + + + KtorServlet + / + + + \ No newline at end of file From 423ccc6a83e5de0529f9854c3efc422cc75c286c Mon Sep 17 00:00:00 2001 From: Syed Mansoor Date: Mon, 18 Jun 2018 23:31:04 +1000 Subject: [PATCH 04/18] [BAEL-1753] Cleanup code --- kotlin-ktor/.gitignore | 1 + kotlin-ktor/build.gradle | 2 +- .../META-INF/KtorExample_main.kotlin_module | Bin 31 -> 0 bytes kotlin-ktor/resources/application.conf | 5 ----- kotlin-ktor/src/main/kotlin/APIServer.kt | 17 ++++++++++++----- 5 files changed, 14 insertions(+), 11 deletions(-) delete mode 100644 kotlin-ktor/out/production/classes/META-INF/KtorExample_main.kotlin_module delete mode 100755 kotlin-ktor/resources/application.conf diff --git a/kotlin-ktor/.gitignore b/kotlin-ktor/.gitignore index 1db5e66882..0c017e8f8c 100644 --- a/kotlin-ktor/.gitignore +++ b/kotlin-ktor/.gitignore @@ -7,6 +7,7 @@ #ignore build and generated files build/ node/ +out/ #ignore installed node modules and package lock file node_modules/ diff --git a/kotlin-ktor/build.gradle b/kotlin-ktor/build.gradle index 95c993b923..11aef74857 100755 --- a/kotlin-ktor/build.gradle +++ b/kotlin-ktor/build.gradle @@ -37,7 +37,7 @@ repositories { dependencies { compile "io.ktor:ktor-server-netty:$ktor_version" compile "ch.qos.logback:logback-classic:1.2.1" - compile "com.google.code.gson:gson:2.8.1" + compile "io.ktor:ktor-gson:$ktor_version" testCompile group: 'junit', name: 'junit', version: '4.12' } diff --git a/kotlin-ktor/out/production/classes/META-INF/KtorExample_main.kotlin_module b/kotlin-ktor/out/production/classes/META-INF/KtorExample_main.kotlin_module deleted file mode 100644 index 3a457da8fc1f80c3d62dad3e91da31eaeadc7597..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 31 gcmZQzU|?ooU|@t|E-qd!1|d$z0MFpmqO#N?024+7od5s; diff --git a/kotlin-ktor/resources/application.conf b/kotlin-ktor/resources/application.conf deleted file mode 100755 index 111af5304c..0000000000 --- a/kotlin-ktor/resources/application.conf +++ /dev/null @@ -1,5 +0,0 @@ -ktor { - application { - modules = [ io.ktor.samples.HelloKt.main ] - } -} \ No newline at end of file diff --git a/kotlin-ktor/src/main/kotlin/APIServer.kt b/kotlin-ktor/src/main/kotlin/APIServer.kt index 3aa1fa96f9..e67609e8b2 100755 --- a/kotlin-ktor/src/main/kotlin/APIServer.kt +++ b/kotlin-ktor/src/main/kotlin/APIServer.kt @@ -1,12 +1,16 @@ @file:JvmName("APIServer") -import com.google.gson.Gson + + import io.ktor.application.call import io.ktor.application.install import io.ktor.features.CallLogging +import io.ktor.features.ContentNegotiation import io.ktor.features.DefaultHeaders +import io.ktor.gson.gson import io.ktor.http.ContentType import io.ktor.request.path +import io.ktor.response.respond import io.ktor.response.respondText import io.ktor.routing.get import io.ktor.routing.routing @@ -14,6 +18,7 @@ import io.ktor.server.engine.embeddedServer import io.ktor.server.netty.Netty import org.slf4j.event.Level +data class Author(val name: String, val website: String) fun main(args: Array) { val jsonResponse = """{ @@ -22,7 +27,6 @@ fun main(args: Array) { "description": "Pay water bill today", }""" - data class Author(val name: String, val website: String) embeddedServer(Netty, 8080) { install(DefaultHeaders) { @@ -33,15 +37,18 @@ fun main(args: Array) { filter { call -> call.request.path().startsWith("/todo") } filter { call -> call.request.path().startsWith("/author") } } + install(ContentNegotiation) { + gson { + setPrettyPrinting() + } + } routing { get("/todo") { call.respondText(jsonResponse, ContentType.Application.Json) } get("/author") { val author = Author("baeldung", "baeldung.com") - val gson = Gson() - val json = gson.toJson(author) - call.respondText(json, ContentType.Application.Json) + call.respond(author) } From c4d62a47da3c3543b958ee0310670cc7fe9b20d9 Mon Sep 17 00:00:00 2001 From: Bahtiyar Kaba Date: Thu, 17 May 2018 22:56:58 +0300 Subject: [PATCH 05/18] add test-containers module --- testing-modules/test-containers/README.md | 2 + testing-modules/test-containers/pom.xml | 109 ++++++++++++++++++ .../testconainers/GenericContainerTests.java | 45 ++++++++ .../PostgreSqlContainerTests.java | 36 ++++++ 4 files changed, 192 insertions(+) create mode 100644 testing-modules/test-containers/README.md create mode 100644 testing-modules/test-containers/pom.xml create mode 100644 testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java create mode 100644 testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerTests.java diff --git a/testing-modules/test-containers/README.md b/testing-modules/test-containers/README.md new file mode 100644 index 0000000000..160893581d --- /dev/null +++ b/testing-modules/test-containers/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Docker Test Containers in Java Tests](TODO link to be added.) diff --git a/testing-modules/test-containers/pom.xml b/testing-modules/test-containers/pom.xml new file mode 100644 index 0000000000..bb426675e5 --- /dev/null +++ b/testing-modules/test-containers/pom.xml @@ -0,0 +1,109 @@ + + + 4.0.0 + + + test-containers + 1.0-SNAPSHOT + + test-containers + Intro to Java Test Containers + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + ../../ + + + + + + + src/test/resources + true + + + + + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + org.junit.platform + junit-platform-surefire-provider + ${junit.platform.version} + + + + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + + java + + + + + com.baeldung.TestLauncher + + + + + + + + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + org.junit.vintage + junit-vintage-engine + ${junit.vintage.version} + test + + + org.apache.logging.log4j + log4j-core + ${log4j2.version} + + + org.testcontainers + testcontainers + 1.7.2 + + + org.testcontainers + postgresql + 1.7.2 + + + org.postgresql + postgresql + 42.2.2 + + + + + + UTF-8 + 1.8 + 5.1.0 + 1.0.1 + 4.12.1 + 2.8.2 + 1.4.196 + 2.11.0 + + 3.7.0 + 2.19.1 + 5.0.1.RELEASE + + + diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java new file mode 100644 index 0000000000..132fca5ad3 --- /dev/null +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java @@ -0,0 +1,45 @@ +package com.baeldung.testconainers; + +import static org.junit.Assert.assertEquals; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.platform.commons.annotation.Testable; +import org.testcontainers.containers.GenericContainer; + +@Testable +public class GenericContainerTests { + @ClassRule + public static GenericContainer simpleWebServer = new GenericContainer("alpine:3.2") + .withExposedPorts(80) + .withCommand("/bin/sh", "-c", "while true; do echo " + + "\"HTTP/1.1 200 OK\n\nHello World!\" | nc -l -p 80; done"); + + @Test + public void givenSimpleWebServerContainer_whenGetReuqest_thenReturnsResponse() throws Exception { + String address = "http://" + simpleWebServer.getContainerIpAddress() + ":" + simpleWebServer.getMappedPort(80); + String response = simpleGetRequest(address); + assertEquals(response, "Hello World!"); + } + + private String simpleGetRequest(String address) throws Exception { + URL url = new URL(address); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestMethod("GET"); + + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuffer content = new StringBuffer(); + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + in.close(); + + return content.toString(); + } +} diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerTests.java new file mode 100644 index 0000000000..4261fa2353 --- /dev/null +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerTests.java @@ -0,0 +1,36 @@ +package com.baeldung.testconainers; + +import static org.junit.Assert.assertEquals; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.platform.commons.annotation.Testable; +import org.testcontainers.containers.PostgreSQLContainer; + +@Testable +public class PostgreSqlContainerTests { + @Rule + public PostgreSQLContainer postgresContainer = new PostgreSQLContainer(); + + @Test + public void whenSelectQueryExecuted_thenResulstsReturned() throws Exception { + ResultSet resultSet = performQuery(postgresContainer, "SELECT 1"); + resultSet.next(); + int result = resultSet.getInt(1); + assertEquals(1, result); + } + + private ResultSet performQuery(PostgreSQLContainer postgres, String query) throws SQLException { + String jdbcUrl = postgres.getJdbcUrl(); + String username = postgres.getUsername(); + String password = postgres.getPassword(); + Connection conn = DriverManager.getConnection(jdbcUrl, username, password); + return conn.createStatement() + .executeQuery(query); + } +} From 2e125a0da399399c9aaf1e1eb0b389df6580e5d6 Mon Sep 17 00:00:00 2001 From: Bahtiyar Kaba Date: Thu, 17 May 2018 22:59:11 +0300 Subject: [PATCH 06/18] Update parent pom to include test-containers module --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 8c87983870..215da5d9d9 100644 --- a/pom.xml +++ b/pom.xml @@ -248,6 +248,7 @@ persistence-modules/liquibase spring-boot-property-exp testing-modules/mockserver + testing-modules/test-containers undertow vertx-and-rxjava saas From 0c231ed0e6e7b8baa158d7468eb68ba9136a2bc7 Mon Sep 17 00:00:00 2001 From: Bahtiyar Kaba Date: Tue, 5 Jun 2018 09:23:56 +0300 Subject: [PATCH 07/18] webdriver test added --- testing-modules/test-containers/pom.xml | 10 +++++++ .../WebDriverContainerTests.java | 29 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java diff --git a/testing-modules/test-containers/pom.xml b/testing-modules/test-containers/pom.xml index bb426675e5..3551092c57 100644 --- a/testing-modules/test-containers/pom.xml +++ b/testing-modules/test-containers/pom.xml @@ -83,11 +83,21 @@ postgresql 1.7.2 + + org.testcontainers + selenium + 1.7.2 + org.postgresql postgresql 42.2.2 + + org.seleniumhq.selenium + selenium-remote-driver + 3.12.0 + diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java new file mode 100644 index 0000000000..f6cc5abc8a --- /dev/null +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java @@ -0,0 +1,29 @@ +package com.baeldung.testconainers; + +import static org.junit.Assert.assertEquals; + +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.remote.RemoteWebDriver; +import org.testcontainers.DockerClientFactory; +import org.testcontainers.containers.BrowserWebDriverContainer; +import org.testcontainers.containers.GenericContainer; + +import net.codestory.http.WebServer; + +public class WebDriverContainerTests { + @Rule + public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer().withDesiredCapabilities(DesiredCapabilities.chrome()); + + @Test + public void when() { + RemoteWebDriver driver = chrome.getWebDriver(); + driver.get("https://saucelabs.com/test/guinea-pig"); + String heading = driver.findElement(By.xpath("/html/body/h1")) + .getText(); + assertEquals("This page is a Selenium sandbox", heading); + } +} From 8f3f5cdec1da41646b8f3f19b26085d22d612ab3 Mon Sep 17 00:00:00 2001 From: Bahtiyar Kaba Date: Mon, 11 Jun 2018 23:13:22 +0300 Subject: [PATCH 08/18] rename test method name --- .../com/baeldung/testconainers/WebDriverContainerTests.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java index f6cc5abc8a..deadf130a3 100644 --- a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java @@ -12,18 +12,17 @@ import org.testcontainers.DockerClientFactory; import org.testcontainers.containers.BrowserWebDriverContainer; import org.testcontainers.containers.GenericContainer; -import net.codestory.http.WebServer; - public class WebDriverContainerTests { @Rule public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer().withDesiredCapabilities(DesiredCapabilities.chrome()); @Test - public void when() { + public void whenNavigatedToPage_thenHeadingIsInThePage() { RemoteWebDriver driver = chrome.getWebDriver(); driver.get("https://saucelabs.com/test/guinea-pig"); String heading = driver.findElement(By.xpath("/html/body/h1")) .getText(); assertEquals("This page is a Selenium sandbox", heading); } + } From 4931f31d915120ea3c4c312ebc88a71bdc7c65f2 Mon Sep 17 00:00:00 2001 From: Bahtiyar Kaba Date: Mon, 11 Jun 2018 23:19:11 +0300 Subject: [PATCH 09/18] Added docker compose tests for testcontainers module --- .../DockerComposeContainerTests.java | 42 +++++++++++++++++++ .../src/test/resources/test-compose.yml | 3 ++ 2 files changed, 45 insertions(+) create mode 100644 testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java create mode 100644 testing-modules/test-containers/src/test/resources/test-compose.yml diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java new file mode 100644 index 0000000000..32345a486c --- /dev/null +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java @@ -0,0 +1,42 @@ +package com.baeldung.testconainers; + +import static org.junit.Assert.assertEquals; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; + +import org.junit.ClassRule; +import org.junit.Test; +import org.testcontainers.containers.DockerComposeContainer; + +public class DockerComposeContainerTests { +@ClassRule +public static DockerComposeContainer compose = new DockerComposeContainer(new File("src/test/resources/test-compose.yml")) + .withExposedService("simpleWebServer_1", 80); + + @Test + public void when() throws Exception { + String address ="http://" + compose.getServiceHost("simpleWebServer_1", 80)+ ":"+ compose.getServicePort("simpleWebServer_1", 80); + String response = simpleGetRequest(address); + assertEquals(response, "Hello World!"); + } + + private String simpleGetRequest(String address) throws Exception { + URL url = new URL(address); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setRequestMethod("GET"); + + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuffer content = new StringBuffer(); + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + in.close(); + + return content.toString(); + } +} diff --git a/testing-modules/test-containers/src/test/resources/test-compose.yml b/testing-modules/test-containers/src/test/resources/test-compose.yml new file mode 100644 index 0000000000..3810c1c589 --- /dev/null +++ b/testing-modules/test-containers/src/test/resources/test-compose.yml @@ -0,0 +1,3 @@ +simpleWebServer: + image: alpine:3.2 + command: ["/bin/sh", "-c", "while true; do echo 'HTTP/1.1 200 OK\n\nHello World!' | nc -l -p 80; done"] From 8fd641b074d5915076e6d385f8544222f49dbe5e Mon Sep 17 00:00:00 2001 From: Bahtiyar Kaba Date: Thu, 14 Jun 2018 14:55:32 +0300 Subject: [PATCH 10/18] formatting corrections on test-container tests --- .../DockerComposeContainerTests.java | 19 ++++++++++++------- .../testconainers/GenericContainerTests.java | 18 ++++++++++++------ .../WebDriverContainerTests.java | 4 +++- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java index 32345a486c..745cb67145 100644 --- a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java @@ -13,17 +13,22 @@ import org.junit.Test; import org.testcontainers.containers.DockerComposeContainer; public class DockerComposeContainerTests { -@ClassRule -public static DockerComposeContainer compose = new DockerComposeContainer(new File("src/test/resources/test-compose.yml")) - .withExposedService("simpleWebServer_1", 80); - + @ClassRule + public static DockerComposeContainer compose = + new DockerComposeContainer( + new File("src/test/resources/test-compose.yml")) + .withExposedService("simpleWebServer_1", 80); + @Test - public void when() throws Exception { - String address ="http://" + compose.getServiceHost("simpleWebServer_1", 80)+ ":"+ compose.getServicePort("simpleWebServer_1", 80); + public void givenSimpleWebServerContainer_whenGetReuqest_thenReturnsResponse() + throws Exception { + String address = "http://" + compose.getServiceHost("simpleWebServer_1", 80) + + ":" + compose.getServicePort("simpleWebServer_1", 80); String response = simpleGetRequest(address); + assertEquals(response, "Hello World!"); } - + private String simpleGetRequest(String address) throws Exception { URL url = new URL(address); HttpURLConnection con = (HttpURLConnection) url.openConnection(); diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java index 132fca5ad3..61da6fc57b 100644 --- a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java @@ -15,15 +15,20 @@ import org.testcontainers.containers.GenericContainer; @Testable public class GenericContainerTests { @ClassRule - public static GenericContainer simpleWebServer = new GenericContainer("alpine:3.2") + public static GenericContainer simpleWebServer = + new GenericContainer("alpine:3.2") .withExposedPorts(80) - .withCommand("/bin/sh", "-c", "while true; do echo " - + "\"HTTP/1.1 200 OK\n\nHello World!\" | nc -l -p 80; done"); + .withCommand("/bin/sh", "-c", "while true; do echo " + + "\"HTTP/1.1 200 OK\n\nHello World!\" | nc -l -p 80; done"); @Test - public void givenSimpleWebServerContainer_whenGetReuqest_thenReturnsResponse() throws Exception { - String address = "http://" + simpleWebServer.getContainerIpAddress() + ":" + simpleWebServer.getMappedPort(80); + public void givenSimpleWebServerContainer_whenGetReuqest_thenReturnsResponse() + throws Exception { + String address = "http://" + + simpleWebServer.getContainerIpAddress() + + ":" + simpleWebServer.getMappedPort(80); String response = simpleGetRequest(address); + assertEquals(response, "Hello World!"); } @@ -32,7 +37,8 @@ public class GenericContainerTests { HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); - BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + BufferedReader in = new BufferedReader( + new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer content = new StringBuffer(); while ((inputLine = in.readLine()) != null) { diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java index deadf130a3..8f7b0af762 100644 --- a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java @@ -14,7 +14,9 @@ import org.testcontainers.containers.GenericContainer; public class WebDriverContainerTests { @Rule - public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer().withDesiredCapabilities(DesiredCapabilities.chrome()); + public BrowserWebDriverContainer chrome + = new BrowserWebDriverContainer() + .withDesiredCapabilities(DesiredCapabilities.chrome()); @Test public void whenNavigatedToPage_thenHeadingIsInThePage() { From b0062c48ed2e98d558729348025e9c69e395d3da Mon Sep 17 00:00:00 2001 From: Bahtiyar Kaba Date: Mon, 18 Jun 2018 09:26:33 +0300 Subject: [PATCH 11/18] apply naming conventions to test-container test names --- ...eContainerTests.java => DockerComposeContainerUnitTest.java} | 2 +- ...GenericContainerTests.java => GenericContainerUnitTest.java} | 2 +- ...eSqlContainerTests.java => PostgreSqlContainerUnitTest.java} | 2 +- ...riverContainerTests.java => WebDriverContainerUnitTest.java} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename testing-modules/test-containers/src/test/java/com/baeldung/testconainers/{DockerComposeContainerTests.java => DockerComposeContainerUnitTest.java} (97%) rename testing-modules/test-containers/src/test/java/com/baeldung/testconainers/{GenericContainerTests.java => GenericContainerUnitTest.java} (97%) rename testing-modules/test-containers/src/test/java/com/baeldung/testconainers/{PostgreSqlContainerTests.java => PostgreSqlContainerUnitTest.java} (96%) rename testing-modules/test-containers/src/test/java/com/baeldung/testconainers/{WebDriverContainerTests.java => WebDriverContainerUnitTest.java} (95%) diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerUnitTest.java similarity index 97% rename from testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java rename to testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerUnitTest.java index 745cb67145..f51721ecde 100644 --- a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerTests.java +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/DockerComposeContainerUnitTest.java @@ -12,7 +12,7 @@ import org.junit.ClassRule; import org.junit.Test; import org.testcontainers.containers.DockerComposeContainer; -public class DockerComposeContainerTests { +public class DockerComposeContainerUnitTest { @ClassRule public static DockerComposeContainer compose = new DockerComposeContainer( diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerUnitTest.java similarity index 97% rename from testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java rename to testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerUnitTest.java index 61da6fc57b..32dbba7dcf 100644 --- a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerTests.java +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/GenericContainerUnitTest.java @@ -13,7 +13,7 @@ import org.junit.platform.commons.annotation.Testable; import org.testcontainers.containers.GenericContainer; @Testable -public class GenericContainerTests { +public class GenericContainerUnitTest { @ClassRule public static GenericContainer simpleWebServer = new GenericContainer("alpine:3.2") diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerUnitTest.java similarity index 96% rename from testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerTests.java rename to testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerUnitTest.java index 4261fa2353..f458f1a999 100644 --- a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerTests.java +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/PostgreSqlContainerUnitTest.java @@ -13,7 +13,7 @@ import org.junit.platform.commons.annotation.Testable; import org.testcontainers.containers.PostgreSQLContainer; @Testable -public class PostgreSqlContainerTests { +public class PostgreSqlContainerUnitTest { @Rule public PostgreSQLContainer postgresContainer = new PostgreSQLContainer(); diff --git a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerUnitTest.java similarity index 95% rename from testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java rename to testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerUnitTest.java index 8f7b0af762..c10deac0f7 100644 --- a/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerTests.java +++ b/testing-modules/test-containers/src/test/java/com/baeldung/testconainers/WebDriverContainerUnitTest.java @@ -12,7 +12,7 @@ import org.testcontainers.DockerClientFactory; import org.testcontainers.containers.BrowserWebDriverContainer; import org.testcontainers.containers.GenericContainer; -public class WebDriverContainerTests { +public class WebDriverContainerUnitTest { @Rule public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer() From 4109abebf9fb232f1a33a133fbc9c4116d9a2931 Mon Sep 17 00:00:00 2001 From: Alejandro Gervasio Date: Tue, 19 Jun 2018 18:19:56 -0300 Subject: [PATCH 12/18] An Introduction to CDI (Contexts and Dependency Injection) (#4503) * Initial Commit * Update pom.xml * Update TimeLoggerFactoryUnitTest.java * Update PngFileEditorUnitTest.java --- cdi/pom.xml | 20 +++++- .../application/FileApplication.java | 18 +++++ .../factories/TimeLoggerFactory.java | 14 ++++ .../imagefileeditors/GifFileEditor.java | 27 +++++++ .../imagefileeditors/ImageFileEditor.java | 12 ++++ .../imagefileeditors/JpgFileEditor.java | 27 +++++++ .../imagefileeditors/PngFileEditor.java | 27 +++++++ .../imageprocessors/ImageFileProcessor.java | 42 +++++++++++ .../loggers/TimeLogger.java | 19 +++++ .../qualifiers/GifFileEditorQualifier.java | 12 ++++ .../qualifiers/JpgFileEditorQualifier.java | 12 ++++ .../qualifiers/PngFileEditorQualifier.java | 12 ++++ .../GifFileEditorUnitTest.java | 37 ++++++++++ .../ImageProcessorUnitTest.java | 70 +++++++++++++++++++ .../JpgFileEditorUnitTest.java | 37 ++++++++++ .../PngFileEditorUnitTest.java | 39 +++++++++++ .../TimeLoggerFactoryUnitTest.java | 15 ++++ .../TimeLoggerUnitTest.java | 20 ++++++ 18 files changed, 459 insertions(+), 1 deletion(-) create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/application/FileApplication.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/factories/TimeLoggerFactory.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/GifFileEditor.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/ImageFileEditor.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/JpgFileEditor.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/PngFileEditor.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/imageprocessors/ImageFileProcessor.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/loggers/TimeLogger.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/GifFileEditorQualifier.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/JpgFileEditorQualifier.java create mode 100644 cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/PngFileEditorQualifier.java create mode 100644 cdi/src/test/java/com/baeldung/test/dependencyinjection/GifFileEditorUnitTest.java create mode 100644 cdi/src/test/java/com/baeldung/test/dependencyinjection/ImageProcessorUnitTest.java create mode 100644 cdi/src/test/java/com/baeldung/test/dependencyinjection/JpgFileEditorUnitTest.java create mode 100644 cdi/src/test/java/com/baeldung/test/dependencyinjection/PngFileEditorUnitTest.java create mode 100644 cdi/src/test/java/com/baeldung/test/dependencyinjection/TimeLoggerFactoryUnitTest.java create mode 100644 cdi/src/test/java/com/baeldung/test/dependencyinjection/TimeLoggerUnitTest.java diff --git a/cdi/pom.xml b/cdi/pom.xml index 0c14df6e73..1d14e3c267 100644 --- a/cdi/pom.xml +++ b/cdi/pom.xml @@ -14,6 +14,24 @@ + + org.hamcrest + hamcrest-core + 1.3 + test + + + org.assertj + assertj-core + 3.10.0 + test + + + junit + junit + 4.12 + test + org.springframework spring-context @@ -42,4 +60,4 @@ 2.4.1.Final - \ No newline at end of file + diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/application/FileApplication.java b/cdi/src/main/java/com/baeldung/dependencyinjection/application/FileApplication.java new file mode 100644 index 0000000000..2ae8ac9621 --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/application/FileApplication.java @@ -0,0 +1,18 @@ +package com.baeldung.dependencyinjection.application; + +import com.baeldung.dependencyinjection.imageprocessors.ImageFileProcessor; +import org.jboss.weld.environment.se.Weld; +import org.jboss.weld.environment.se.WeldContainer; + +public class FileApplication { + + public static void main(String[] args) { + Weld weld = new Weld(); + WeldContainer container = weld.initialize(); + ImageFileProcessor imageFileProcessor = container.select(ImageFileProcessor.class).get(); + System.out.println(imageFileProcessor.openFile("file1.png")); + System.out.println(imageFileProcessor.writeFile("file1.png")); + System.out.println(imageFileProcessor.saveFile("file1.png")); + container.shutdown(); + } +} \ No newline at end of file diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/factories/TimeLoggerFactory.java b/cdi/src/main/java/com/baeldung/dependencyinjection/factories/TimeLoggerFactory.java new file mode 100644 index 0000000000..86916fa8c4 --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/factories/TimeLoggerFactory.java @@ -0,0 +1,14 @@ +package com.baeldung.dependencyinjection.factories; + +import com.baeldung.dependencyinjection.loggers.TimeLogger; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import javax.enterprise.inject.Produces; + +public class TimeLoggerFactory { + + @Produces + public TimeLogger getTimeLogger() { + return new TimeLogger(new SimpleDateFormat("HH:mm"), Calendar.getInstance()); + } +} \ No newline at end of file diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/GifFileEditor.java b/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/GifFileEditor.java new file mode 100644 index 0000000000..6b51d64a33 --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/GifFileEditor.java @@ -0,0 +1,27 @@ +package com.baeldung.dependencyinjection.imagefileeditors; + +import com.baeldung.dependencyinjection.qualifiers.GifFileEditorQualifier; + +@GifFileEditorQualifier +public class GifFileEditor implements ImageFileEditor { + + @Override + public String openFile(String fileName) { + return "Opening GIF file " + fileName; + } + + @Override + public String editFile(String fileName) { + return "Editing GIF file " + fileName; + } + + @Override + public String writeFile(String fileName) { + return "Writing GIF file " + fileName; + } + + @Override + public String saveFile(String fileName) { + return "Saving GIF file " + fileName; + } +} \ No newline at end of file diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/ImageFileEditor.java b/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/ImageFileEditor.java new file mode 100644 index 0000000000..d524a5160a --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/ImageFileEditor.java @@ -0,0 +1,12 @@ +package com.baeldung.dependencyinjection.imagefileeditors; + +public interface ImageFileEditor { + + String openFile(String fileName); + + String editFile(String fileName); + + String writeFile(String fileName); + + String saveFile(String fileName); +} \ No newline at end of file diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/JpgFileEditor.java b/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/JpgFileEditor.java new file mode 100644 index 0000000000..97adebc1af --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/JpgFileEditor.java @@ -0,0 +1,27 @@ +package com.baeldung.dependencyinjection.imagefileeditors; + +import com.baeldung.dependencyinjection.qualifiers.JpgFileEditorQualifier; + +@JpgFileEditorQualifier +public class JpgFileEditor implements ImageFileEditor { + + @Override + public String openFile(String fileName) { + return "Opening JPG file " + fileName; + } + + @Override + public String editFile(String fileName) { + return "Editing JPG file " + fileName; + } + + @Override + public String writeFile(String fileName) { + return "Writing JPG file " + fileName; + } + + @Override + public String saveFile(String fileName) { + return "Saving JPG file " + fileName; + } +} \ No newline at end of file diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/PngFileEditor.java b/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/PngFileEditor.java new file mode 100644 index 0000000000..5db608539c --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/imagefileeditors/PngFileEditor.java @@ -0,0 +1,27 @@ +package com.baeldung.dependencyinjection.imagefileeditors; + +import com.baeldung.dependencyinjection.qualifiers.PngFileEditorQualifier; + +@PngFileEditorQualifier +public class PngFileEditor implements ImageFileEditor { + + @Override + public String openFile(String fileName) { + return "Opening PNG file " + fileName; + } + + @Override + public String editFile(String fileName) { + return "Editing PNG file " + fileName; + } + + @Override + public String writeFile(String fileName) { + return "Writing PNG file " + fileName; + } + + @Override + public String saveFile(String fileName) { + return "Saving PNG file " + fileName; + } +} \ No newline at end of file diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/imageprocessors/ImageFileProcessor.java b/cdi/src/main/java/com/baeldung/dependencyinjection/imageprocessors/ImageFileProcessor.java new file mode 100644 index 0000000000..1527108568 --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/imageprocessors/ImageFileProcessor.java @@ -0,0 +1,42 @@ +package com.baeldung.dependencyinjection.imageprocessors; + +import com.baeldung.dependencyinjection.loggers.TimeLogger; +import com.baeldung.dependencyinjection.qualifiers.PngFileEditorQualifier; +import javax.inject.Inject; +import com.baeldung.dependencyinjection.imagefileeditors.ImageFileEditor; + +public class ImageFileProcessor { + + private final ImageFileEditor imageFileEditor; + private final TimeLogger timeLogger; + + @Inject + public ImageFileProcessor(@PngFileEditorQualifier ImageFileEditor imageFileEditor, TimeLogger timeLogger) { + this.imageFileEditor = imageFileEditor; + this.timeLogger = timeLogger; + } + + public ImageFileEditor getImageFileditor() { + return imageFileEditor; + } + + public TimeLogger getTimeLogger() { + return timeLogger; + } + + public String openFile(String fileName) { + return imageFileEditor.openFile(fileName) + " at: " + timeLogger.getTime(); + } + + public String editFile(String fileName) { + return imageFileEditor.editFile(fileName) + " at: " + timeLogger.getTime(); + } + + public String writeFile(String fileName) { + return imageFileEditor.writeFile(fileName) + " at: " + timeLogger.getTime(); + } + + public String saveFile(String fileName) { + return imageFileEditor.saveFile(fileName)+ " at: " + timeLogger.getTime(); + } +} \ No newline at end of file diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/loggers/TimeLogger.java b/cdi/src/main/java/com/baeldung/dependencyinjection/loggers/TimeLogger.java new file mode 100644 index 0000000000..44223d7e5d --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/loggers/TimeLogger.java @@ -0,0 +1,19 @@ +package com.baeldung.dependencyinjection.loggers; + +import java.text.SimpleDateFormat; +import java.util.Calendar; + +public class TimeLogger { + + private final SimpleDateFormat dateFormat; + private final Calendar calendar; + + public TimeLogger(SimpleDateFormat dateFormat, Calendar calendar) { + this.dateFormat = dateFormat; + this.calendar = calendar; + } + + public String getTime() { + return dateFormat.format(calendar.getTime()); + } +} \ No newline at end of file diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/GifFileEditorQualifier.java b/cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/GifFileEditorQualifier.java new file mode 100644 index 0000000000..3660aad15e --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/GifFileEditorQualifier.java @@ -0,0 +1,12 @@ +package com.baeldung.dependencyinjection.qualifiers; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.inject.Qualifier; + +@Qualifier +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER}) +public @interface GifFileEditorQualifier {} \ No newline at end of file diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/JpgFileEditorQualifier.java b/cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/JpgFileEditorQualifier.java new file mode 100644 index 0000000000..c8a007bcab --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/JpgFileEditorQualifier.java @@ -0,0 +1,12 @@ +package com.baeldung.dependencyinjection.qualifiers; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.inject.Qualifier; + +@Qualifier +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER}) +public @interface JpgFileEditorQualifier {} diff --git a/cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/PngFileEditorQualifier.java b/cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/PngFileEditorQualifier.java new file mode 100644 index 0000000000..51d2fba315 --- /dev/null +++ b/cdi/src/main/java/com/baeldung/dependencyinjection/qualifiers/PngFileEditorQualifier.java @@ -0,0 +1,12 @@ +package com.baeldung.dependencyinjection.qualifiers; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import javax.inject.Qualifier; + +@Qualifier +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER}) +public @interface PngFileEditorQualifier {} diff --git a/cdi/src/test/java/com/baeldung/test/dependencyinjection/GifFileEditorUnitTest.java b/cdi/src/test/java/com/baeldung/test/dependencyinjection/GifFileEditorUnitTest.java new file mode 100644 index 0000000000..3b148049b5 --- /dev/null +++ b/cdi/src/test/java/com/baeldung/test/dependencyinjection/GifFileEditorUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.test.dependencyinjection; + +import com.baeldung.dependencyinjection.imagefileeditors.GifFileEditor; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.BeforeClass; +import org.junit.Test; + +public class GifFileEditorUnitTest { + + private static GifFileEditor gifFileEditor; + + + @BeforeClass + public static void setGifFileEditorInstance() { + gifFileEditor = new GifFileEditor(); + } + + @Test + public void givenGifFileEditorlInstance_whenCalledopenFile_thenOneAssertion() { + assertThat(gifFileEditor.openFile("file1.gif")).isEqualTo("Opening GIF file file1.gif"); + } + + @Test + public void givenGifFileEditorlInstance_whenCallededitFile_thenOneAssertion() { + assertThat(gifFileEditor.editFile("file1.gif")).isEqualTo("Editing GIF file file1.gif"); + } + + @Test + public void givenGifFileEditorInstance_whenCalledwriteFile_thenOneAssertion() { + assertThat(gifFileEditor.writeFile("file1.gif")).isEqualTo("Writing GIF file file1.gif"); + } + + @Test + public void givenGifFileEditorInstance_whenCalledsaveFile_thenOneAssertion() { + assertThat(gifFileEditor.saveFile("file1.gif")).isEqualTo("Saving GIF file file1.gif"); + } +} \ No newline at end of file diff --git a/cdi/src/test/java/com/baeldung/test/dependencyinjection/ImageProcessorUnitTest.java b/cdi/src/test/java/com/baeldung/test/dependencyinjection/ImageProcessorUnitTest.java new file mode 100644 index 0000000000..8b5fa409c9 --- /dev/null +++ b/cdi/src/test/java/com/baeldung/test/dependencyinjection/ImageProcessorUnitTest.java @@ -0,0 +1,70 @@ +package com.baeldung.test.dependencyinjection; + +import com.baeldung.dependencyinjection.imagefileeditors.GifFileEditor; +import com.baeldung.dependencyinjection.imagefileeditors.JpgFileEditor; +import com.baeldung.dependencyinjection.imagefileeditors.PngFileEditor; +import com.baeldung.dependencyinjection.imageprocessors.ImageFileProcessor; +import com.baeldung.dependencyinjection.loggers.TimeLogger; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import static org.assertj.core.api.Assertions.assertThat; +import org.jboss.weld.environment.se.Weld; +import org.jboss.weld.environment.se.WeldContainer; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ImageProcessorUnitTest { + + private static ImageFileProcessor imageFileProcessor; + private static SimpleDateFormat dateFormat; + private static Calendar calendar; + + + @BeforeClass + public static void setImageProcessorInstance() { + Weld weld = new Weld(); + WeldContainer container = weld.initialize(); + imageFileProcessor = container.select(ImageFileProcessor.class).get(); + container.shutdown(); + } + + @BeforeClass + public static void setSimpleDateFormatInstance() { + dateFormat = new SimpleDateFormat("HH:mm"); + } + + @BeforeClass + public static void setCalendarInstance() { + calendar = Calendar.getInstance(); + } + + @Test + public void givenImageProcessorInstance_whenInjectedPngFileEditorandTimeLoggerInstances_thenTwoAssertions() { + assertThat(imageFileProcessor.getImageFileditor()).isInstanceOf(PngFileEditor.class); + assertThat(imageFileProcessor.getTimeLogger()).isInstanceOf(TimeLogger.class); + } + + @Test + public void givenImageProcessorInstance_whenCalledopenFile_thenOneAssertion() { + String currentTime = dateFormat.format(calendar.getTime()); + assertThat(imageFileProcessor.openFile("file1.png")).isEqualTo("Opening PNG file file1.png at: " + currentTime); + } + + @Test + public void givenImageProcessorInstance_whenCallededitFile_thenOneAssertion() { + String currentTime = dateFormat.format(calendar.getTime()); + assertThat(imageFileProcessor.editFile("file1.png")).isEqualTo("Editing PNG file file1.png at: " + currentTime); + } + + @Test + public void givenImageProcessorInstance_whenCalledwriteFile_thenOneAssertion() { + String currentTime = dateFormat.format(calendar.getTime()); + assertThat(imageFileProcessor.writeFile("file1.png")).isEqualTo("Writing PNG file file1.png at: " + currentTime); + } + + @Test + public void givenImageProcessorInstance_whenCalledsaveFile_thenOneAssertion() { + String currentTime = dateFormat.format(calendar.getTime()); + assertThat(imageFileProcessor.saveFile("file1.png")).isEqualTo("Saving PNG file file1.png at: " + currentTime); + } +} \ No newline at end of file diff --git a/cdi/src/test/java/com/baeldung/test/dependencyinjection/JpgFileEditorUnitTest.java b/cdi/src/test/java/com/baeldung/test/dependencyinjection/JpgFileEditorUnitTest.java new file mode 100644 index 0000000000..4f3954c0bc --- /dev/null +++ b/cdi/src/test/java/com/baeldung/test/dependencyinjection/JpgFileEditorUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.test.dependencyinjection; + +import com.baeldung.dependencyinjection.imagefileeditors.JpgFileEditor; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.BeforeClass; +import org.junit.Test; + +public class JpgFileEditorUnitTest { + + private static JpgFileEditor jpgFileUtil; + + + @BeforeClass + public static void setJpgFileEditorInstance() { + jpgFileUtil = new JpgFileEditor(); + } + + @Test + public void givenJpgFileEditorInstance_whenCalledopenFile_thenOneAssertion() { + assertThat(jpgFileUtil.openFile("file1.jpg")).isEqualTo("Opening JPG file file1.jpg"); + } + + @Test + public void givenJpgFileEditorlInstance_whenCallededitFile_thenOneAssertion() { + assertThat(jpgFileUtil.editFile("file1.gif")).isEqualTo("Editing JPG file file1.gif"); + } + + @Test + public void givenJpgFileEditorInstance_whenCalledwriteFile_thenOneAssertion() { + assertThat(jpgFileUtil.writeFile("file1.jpg")).isEqualTo("Writing JPG file file1.jpg"); + } + + @Test + public void givenJpgFileEditorInstance_whenCalledsaveFile_thenOneAssertion() { + assertThat(jpgFileUtil.saveFile("file1.jpg")).isEqualTo("Saving JPG file file1.jpg"); + } +} \ No newline at end of file diff --git a/cdi/src/test/java/com/baeldung/test/dependencyinjection/PngFileEditorUnitTest.java b/cdi/src/test/java/com/baeldung/test/dependencyinjection/PngFileEditorUnitTest.java new file mode 100644 index 0000000000..d16f6d576e --- /dev/null +++ b/cdi/src/test/java/com/baeldung/test/dependencyinjection/PngFileEditorUnitTest.java @@ -0,0 +1,39 @@ +package com.baeldung.test.dependencyinjection; + +import com.baeldung.dependencyinjection.imagefileeditors.PngFileEditor; +import com.baeldung.dependencyinjection.qualifiers.PngFileEditorQualifier; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.BeforeClass; +import org.junit.Test; + +@PngFileEditorQualifier +public class PngFileEditorUnitTest { + + private static PngFileEditor pngFileEditor; + + + @BeforeClass + public static void setPngFileEditorInstance() { + pngFileEditor = new PngFileEditor(); + } + + @Test + public void givenPngFileEditorInstance_whenCalledopenFile_thenOneAssertion() { + assertThat(pngFileEditor.openFile("file1.png")).isEqualTo("Opening PNG file file1.png"); + } + + @Test + public void givenPngFileEditorInstance_whenCallededitFile_thenOneAssertion() { + assertThat(pngFileEditor.editFile("file1.png")).isEqualTo("Editing PNG file file1.png"); + } + + @Test + public void givenPngFileEditorInstance_whenCalledwriteFile_thenOneAssertion() { + assertThat(pngFileEditor.writeFile("file1.png")).isEqualTo("Writing PNG file file1.png"); + } + + @Test + public void givenPngFileEditorInstance_whenCalledsaveFile_thenOneAssertion() { + assertThat(pngFileEditor.saveFile("file1.png")).isEqualTo("Saving PNG file file1.png"); + } +} diff --git a/cdi/src/test/java/com/baeldung/test/dependencyinjection/TimeLoggerFactoryUnitTest.java b/cdi/src/test/java/com/baeldung/test/dependencyinjection/TimeLoggerFactoryUnitTest.java new file mode 100644 index 0000000000..caf2ed32b5 --- /dev/null +++ b/cdi/src/test/java/com/baeldung/test/dependencyinjection/TimeLoggerFactoryUnitTest.java @@ -0,0 +1,15 @@ +package com.baeldung.test.dependencyinjection; + +import com.baeldung.dependencyinjection.factories.TimeLoggerFactory; +import com.baeldung.dependencyinjection.loggers.TimeLogger; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class TimeLoggerFactoryUnitTest { + + @Test + public void givenTimeLoggerFactory_whenCalledgetTimeLogger_thenOneAssertion() { + TimeLoggerFactory timeLoggerFactory = new TimeLoggerFactory(); + assertThat(timeLoggerFactory.getTimeLogger()).isInstanceOf(TimeLogger.class); + } +} diff --git a/cdi/src/test/java/com/baeldung/test/dependencyinjection/TimeLoggerUnitTest.java b/cdi/src/test/java/com/baeldung/test/dependencyinjection/TimeLoggerUnitTest.java new file mode 100644 index 0000000000..222de251fe --- /dev/null +++ b/cdi/src/test/java/com/baeldung/test/dependencyinjection/TimeLoggerUnitTest.java @@ -0,0 +1,20 @@ +package com.baeldung.test.dependencyinjection; + +import com.baeldung.dependencyinjection.loggers.TimeLogger; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class TimeLoggerUnitTest { + + + @Test + public void givenTimeLoggerInstance_whenCalledgetLogTime_thenOneAssertion() { + SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm"); + Calendar calendar = Calendar.getInstance(); + TimeLogger timeLogger = new TimeLogger(dateFormat, calendar); + String currentTime = dateFormat.format(calendar.getTime()); + assertThat(timeLogger.getTime()).isEqualTo(currentTime); + } +} \ No newline at end of file From d757050209f22665c444e3e203301958f16a008c Mon Sep 17 00:00:00 2001 From: Aprian Diaz Novandi Date: Wed, 20 Jun 2018 00:32:28 +0200 Subject: [PATCH 13/18] BAEL-1200 JavaPoet (#4500) * Initial commit * Implement JavaPoet examples --- libraries/.gitignore | 8 + libraries/pom.xml | 13 ++ .../baeldung/javapoet/PersonGenerator.java | 183 ++++++++++++++++++ .../test/PersonGeneratorUnitTest.java | 99 ++++++++++ .../baeldung/javapoet/test/person/Gender.java | 9 + .../baeldung/javapoet/test/person/Person.java | 13 ++ .../javapoet/test/person/Student.java | 37 ++++ 7 files changed, 362 insertions(+) create mode 100644 libraries/.gitignore create mode 100644 libraries/src/main/java/com/baeldung/javapoet/PersonGenerator.java create mode 100644 libraries/src/test/java/com/baeldung/javapoet/test/PersonGeneratorUnitTest.java create mode 100644 libraries/src/test/java/com/baeldung/javapoet/test/person/Gender.java create mode 100644 libraries/src/test/java/com/baeldung/javapoet/test/person/Person.java create mode 100644 libraries/src/test/java/com/baeldung/javapoet/test/person/Student.java diff --git a/libraries/.gitignore b/libraries/.gitignore new file mode 100644 index 0000000000..ac45fafa62 --- /dev/null +++ b/libraries/.gitignore @@ -0,0 +1,8 @@ +*.class + +# Folders # +/gensrc +/target + +# Packaged files # +*.jar diff --git a/libraries/pom.xml b/libraries/pom.xml index 663b9e68bb..e3a6656995 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -722,6 +722,17 @@ test + + com.squareup + javapoet + ${javapoet.version} + + + org.hamcrest + hamcrest-all + ${hamcrest-all.version} + test + @@ -939,6 +950,8 @@ 3.5.2 3.6 2.7.1 + 1.10.0 + 1.3 \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/javapoet/PersonGenerator.java b/libraries/src/main/java/com/baeldung/javapoet/PersonGenerator.java new file mode 100644 index 0000000000..6dd41cc0bd --- /dev/null +++ b/libraries/src/main/java/com/baeldung/javapoet/PersonGenerator.java @@ -0,0 +1,183 @@ +package com.baeldung.javapoet; + +import com.squareup.javapoet.ClassName; +import com.squareup.javapoet.CodeBlock; +import com.squareup.javapoet.FieldSpec; +import com.squareup.javapoet.JavaFile; +import com.squareup.javapoet.MethodSpec; +import com.squareup.javapoet.ParameterSpec; +import com.squareup.javapoet.ParameterizedTypeName; +import com.squareup.javapoet.TypeName; +import com.squareup.javapoet.TypeSpec; + +import javax.lang.model.element.Modifier; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.stream.IntStream; + +public class PersonGenerator { + + private static final String FOUR_WHITESPACES = " "; + private static final String PERSON_PACKAGE_NAME = "com.baeldung.javapoet.test.person"; + + private File outputFile; + + public PersonGenerator() { + outputFile = new File(getOutputPath().toUri()); + } + + public static String getPersonPackageName() { + return PERSON_PACKAGE_NAME; + } + + public Path getOutputPath() { + return Paths.get(new File(".").getAbsolutePath() + "/gensrc"); + } + + public FieldSpec getDefaultNameField() { + return FieldSpec + .builder(String.class, "DEFAULT_NAME") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL) + .initializer("$S", "Alice") + .build(); + } + + public MethodSpec getSortByLengthMethod() { + return MethodSpec + .methodBuilder("sortByLength") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .addParameter(ParameterSpec + .builder(ParameterizedTypeName.get(ClassName.get(List.class), TypeName.get(String.class)), "strings") + .build()) + .addStatement("$T.sort($N, $L)", Collections.class, "strings", getComparatorAnonymousClass()) + .build(); + } + + public MethodSpec getPrintNameMultipleTimesMethod() { + return MethodSpec + .methodBuilder("printNameMultipleTimes") + .addModifiers(Modifier.PUBLIC) + .addCode(getPrintNameMultipleTimesLambdaImpl()) + .build(); + } + + public CodeBlock getPrintNameMultipleTimesImpl() { + return CodeBlock + .builder() + .beginControlFlow("for (int i = $L; i < $L; i++)") + .addStatement("System.out.println(name)") + .endControlFlow() + .build(); + } + + public CodeBlock getPrintNameMultipleTimesLambdaImpl() { + return CodeBlock + .builder() + .addStatement("$T<$T> names = new $T<>()", List.class, String.class, ArrayList.class) + .addStatement("$T.range($L, $L).forEach(i -> names.add(name))", IntStream.class, 0, 10) + .addStatement("names.forEach(System.out::println)") + .build(); + } + + public TypeSpec getGenderEnum() { + return TypeSpec + .enumBuilder("Gender") + .addModifiers(Modifier.PUBLIC) + .addEnumConstant("MALE") + .addEnumConstant("FEMALE") + .addEnumConstant("UNSPECIFIED") + .build(); + } + + public TypeSpec getPersonInterface() { + return TypeSpec + .interfaceBuilder("Person") + .addModifiers(Modifier.PUBLIC) + .addField(getDefaultNameField()) + .addMethod(MethodSpec + .methodBuilder("getName") + .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) + .returns(String.class) + .build()) + .addMethod(MethodSpec + .methodBuilder("getDefaultName") + .addModifiers(Modifier.PUBLIC, Modifier.DEFAULT) + .returns(String.class) + .addCode(CodeBlock + .builder() + .addStatement("return DEFAULT_NAME") + .build()) + .build()) + .build(); + } + + public TypeSpec getStudentClass() { + return TypeSpec + .classBuilder("Student") + .addSuperinterface(ClassName.get(PERSON_PACKAGE_NAME, "Person")) + .addModifiers(Modifier.PUBLIC) + .addField(FieldSpec + .builder(String.class, "name") + .addModifiers(Modifier.PRIVATE) + .build()) + .addMethod(MethodSpec + .methodBuilder("getName") + .addAnnotation(Override.class) + .addModifiers(Modifier.PUBLIC) + .returns(String.class) + .addStatement("return this.name") + .build()) + .addMethod(MethodSpec + .methodBuilder("setName") + .addParameter(String.class, "name") + .addModifiers(Modifier.PUBLIC) + .addStatement("this.name = name") + .build()) + .addMethod(getPrintNameMultipleTimesMethod()) + .addMethod(getSortByLengthMethod()) + .build(); + } + + public TypeSpec getComparatorAnonymousClass() { + return TypeSpec + .anonymousClassBuilder("") + .addSuperinterface(ParameterizedTypeName.get(Comparator.class, String.class)) + .addMethod(MethodSpec + .methodBuilder("compare") + .addModifiers(Modifier.PUBLIC) + .addAnnotation(Override.class) + .addParameter(String.class, "a") + .addParameter(String.class, "b") + .returns(int.class) + .addStatement("return a.length() - b.length()") + .build()) + .build(); + } + + public void generateGenderEnum() throws IOException { + writeToOutputFile(getPersonPackageName(), getGenderEnum()); + } + + public void generatePersonInterface() throws IOException { + writeToOutputFile(getPersonPackageName(), getPersonInterface()); + } + + public void generateStudentClass() throws IOException { + writeToOutputFile(getPersonPackageName(), getStudentClass()); + } + + private void writeToOutputFile(String packageName, TypeSpec typeSpec) throws IOException { + JavaFile javaFile = JavaFile + .builder(packageName, typeSpec) + .indent(FOUR_WHITESPACES) + .build(); + javaFile.writeTo(outputFile); + } + +} diff --git a/libraries/src/test/java/com/baeldung/javapoet/test/PersonGeneratorUnitTest.java b/libraries/src/test/java/com/baeldung/javapoet/test/PersonGeneratorUnitTest.java new file mode 100644 index 0000000000..61bf3ebc33 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/javapoet/test/PersonGeneratorUnitTest.java @@ -0,0 +1,99 @@ +package com.baeldung.javapoet.test; + +import com.baeldung.javapoet.PersonGenerator; +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +@RunWith(JUnit4.class) +public class PersonGeneratorUnitTest { + + private PersonGenerator generator; + private Path generatedFolderPath; + private Path expectedFolderPath; + + @Before + public void setUp() { + String packagePath = this + .getClass() + .getPackage() + .getName() + .replace(".", "/") + "/person"; + generator = new PersonGenerator(); + generatedFolderPath = generator + .getOutputPath() + .resolve(packagePath); + expectedFolderPath = Paths.get(new File(".").getAbsolutePath() + "/src/test/java/" + packagePath); + } + + @After + public void tearDown() throws Exception { + FileUtils.deleteDirectory(new File(generator + .getOutputPath() + .toUri())); + } + + @Test + public void whenGenerateGenderEnum_thenGenerateGenderEnumAndWriteToFile() throws IOException { + generator.generateGenderEnum(); + String fileName = "Gender.java"; + assertThatFileIsGeneratedAsExpected(fileName); + deleteGeneratedFile(fileName); + } + + @Test + public void whenGeneratePersonInterface_thenGeneratePersonInterfaceAndWriteToFile() throws IOException { + generator.generatePersonInterface(); + String fileName = "Person.java"; + assertThatFileIsGeneratedAsExpected(fileName); + deleteGeneratedFile(fileName); + } + + @Test + public void whenGenerateStudentClass_thenGenerateStudentClassAndWriteToFile() throws IOException { + generator.generateStudentClass(); + String fileName = "Student.java"; + assertThatFileIsGeneratedAsExpected(fileName); + deleteGeneratedFile(fileName); + } + + private void assertThatFileIsGeneratedAsExpected(String fileName) throws IOException { + String generatedFileContent = extractFileContent(generatedFolderPath.resolve(fileName)); + String expectedFileContent = extractFileContent(expectedFolderPath.resolve(fileName)); + + assertThat("Generated file is identical to the file with the expected content", generatedFileContent, is(equalTo(expectedFileContent))); + + } + + private void deleteGeneratedFile(String fileName) throws IOException { + Path generatedFilePath = generatedFolderPath.resolve(fileName); + Files.delete(generatedFilePath); + } + + private String extractFileContent(Path filePath) throws IOException { + byte[] fileContentAsBytes = Files.readAllBytes(filePath); + String fileContentAsString = new String(fileContentAsBytes, StandardCharsets.UTF_8); + + if (!fileContentAsString.contains("\r\n")) { + // file is not in DOS format + // convert it first, so that the content comparison will be relevant + return fileContentAsString.replaceAll("\n", "\r\n"); + } + return fileContentAsString; + } + +} diff --git a/libraries/src/test/java/com/baeldung/javapoet/test/person/Gender.java b/libraries/src/test/java/com/baeldung/javapoet/test/person/Gender.java new file mode 100644 index 0000000000..3c5657fb9d --- /dev/null +++ b/libraries/src/test/java/com/baeldung/javapoet/test/person/Gender.java @@ -0,0 +1,9 @@ +package com.baeldung.javapoet.test.person; + +public enum Gender { + MALE, + + FEMALE, + + UNSPECIFIED +} diff --git a/libraries/src/test/java/com/baeldung/javapoet/test/person/Person.java b/libraries/src/test/java/com/baeldung/javapoet/test/person/Person.java new file mode 100644 index 0000000000..fae8b23075 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/javapoet/test/person/Person.java @@ -0,0 +1,13 @@ +package com.baeldung.javapoet.test.person; + +import java.lang.String; + +public interface Person { + String DEFAULT_NAME = "Alice"; + + String getName(); + + default String getDefaultName() { + return DEFAULT_NAME; + } +} diff --git a/libraries/src/test/java/com/baeldung/javapoet/test/person/Student.java b/libraries/src/test/java/com/baeldung/javapoet/test/person/Student.java new file mode 100644 index 0000000000..1c7d5cc096 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/javapoet/test/person/Student.java @@ -0,0 +1,37 @@ +package com.baeldung.javapoet.test.person; + +import java.lang.Override; +import java.lang.String; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.stream.IntStream; + +public class Student implements Person { + private String name; + + @Override + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public void printNameMultipleTimes() { + List names = new ArrayList<>(); + IntStream.range(0, 10).forEach(i -> names.add(name)); + names.forEach(System.out::println); + } + + public static void sortByLength(List strings) { + Collections.sort(strings, new Comparator() { + @Override + public int compare(String a, String b) { + return a.length() - b.length(); + } + }); + } +} From 6d56fc54380f343695861521414cc6d3a8dfbf42 Mon Sep 17 00:00:00 2001 From: Pablo Castelnovo Date: Wed, 20 Jun 2018 19:42:37 -0400 Subject: [PATCH 14/18] BAEL-1848 final and immutable objects in Java (#4515) * Strange git issue with README.MD, wouldn't revert the file * final and immutable objects in Java * Move tests to src/test/ * BAEL-1848 renamed test class --- .../baeldung/immutableobjects/Currency.java | 18 ++++++++++ .../com/baeldung/immutableobjects/Money.java | 20 +++++++++++ .../ImmutableObjectsUnitTest.java | 36 +++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 core-java/src/main/java/com/baeldung/immutableobjects/Currency.java create mode 100644 core-java/src/main/java/com/baeldung/immutableobjects/Money.java create mode 100644 core-java/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java diff --git a/core-java/src/main/java/com/baeldung/immutableobjects/Currency.java b/core-java/src/main/java/com/baeldung/immutableobjects/Currency.java new file mode 100644 index 0000000000..412d105581 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/immutableobjects/Currency.java @@ -0,0 +1,18 @@ +package com.baeldung.immutableobjects; + +public final class Currency { + + private final String value; + + private Currency(String currencyValue) { + value = currencyValue; + } + + public String getValue() { + return value; + } + + public static Currency of(String value) { + return new Currency(value); + } +} diff --git a/core-java/src/main/java/com/baeldung/immutableobjects/Money.java b/core-java/src/main/java/com/baeldung/immutableobjects/Money.java new file mode 100644 index 0000000000..b509d2e797 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/immutableobjects/Money.java @@ -0,0 +1,20 @@ +package com.baeldung.immutableobjects; + +// 4. Immutability in Java +public final class Money { + private final double amount; + private final Currency currency; + + public Money(double amount, Currency currency) { + this.amount = amount; + this.currency = currency; + } + + public Currency getCurrency() { + return currency; + } + + public double getAmount() { + return amount; + } +} diff --git a/core-java/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java b/core-java/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java new file mode 100644 index 0000000000..01dfeac050 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/immutableobjects/ImmutableObjectsUnitTest.java @@ -0,0 +1,36 @@ +package com.baeldung.immutableobjects; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class ImmutableObjectsUnitTest { + + @Test + public void whenCallingStringReplace_thenStringDoesNotMutate() { + // 2. What's an Immutable Object? + final String name = "baeldung"; + final String newName = name.replace("dung", "----"); + + assertEquals("baeldung", name); + assertEquals("bael----", newName); + } + + public void whenReassignFinalValue_thenCompilerError() { + // 3. The final Keyword in Java (1) + final String name = "baeldung"; + // name = "bael..."; + } + + @Test + public void whenAddingElementToList_thenSizeChange() { + // 3. The final Keyword in Java (2) + final List strings = new ArrayList<>(); + assertEquals(0, strings.size()); + strings.add("baeldung"); + assertEquals(1, strings.size()); + } +} From 1848c25f4958e1c75402e6fed12d03a43069b855 Mon Sep 17 00:00:00 2001 From: Rajat Garg Date: Fri, 22 Jun 2018 00:33:53 +0530 Subject: [PATCH 15/18] Bael 1734 get file extension in java (#4522) * change method to return Optionals * add check for empty Optional * replace ifPresent() with get() * remove extra check --- .../test/java/com/baeldung/extension/ExtensionUnitTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java b/core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java index 14e05d6b95..680eea0cae 100644 --- a/core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java +++ b/core-java/src/test/java/com/baeldung/extension/ExtensionUnitTest.java @@ -19,8 +19,7 @@ public class ExtensionUnitTest { public void getExtension_whenStringHandle_thenExtensionIsTrue() { String expectedExtension = "java"; Optional actualExtension = extension.getExtensionByStringHandling("Demo.java"); - Assert.assertTrue(actualExtension.isPresent()); - actualExtension.ifPresent(ext -> Assert.assertEquals(expectedExtension,ext)); + Assert.assertEquals(expectedExtension, actualExtension.get()); } @Test From f7953fd65dc9f45b30fc693a20f94b9a3befff04 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Fri, 22 Jun 2018 16:39:57 +0530 Subject: [PATCH 16/18] BAEL-6506: Added IntTest to pmd and poms (#4525) --- .gitignore | 6 + core-java-io/pom.xml | 2 + core-java-sun/pom.xml | 1 + core-java/pom.xml | 2 + custom-pmd-0.0.1.jar | Bin 3311 -> 4357 bytes .../pmd/UnitTestNamingConventionRule.java | 1 + .../com/baeldung/jaxb/gen/ObjectFactory.java | 96 +++--- .../com/baeldung/jaxb/gen/UserRequest.java | 174 +++++----- .../com/baeldung/jaxb/gen/UserResponse.java | 298 +++++++++--------- .../com/baeldung/jaxb/gen/package-info.java | 4 +- .../java/org/w3/_2001/xmlschema/Adapter1.java | 46 +-- mustache/pom.xml | 2 + parent-boot-1/pom.xml | 3 +- parent-boot-2/pom.xml | 3 +- pom.xml | 2 + resteasy/pom.xml | 1 + spring-5-mvc/pom.xml | 1 + spring-5-reactive-client/pom.xml | 1 + spring-5-reactive/pom.xml | 1 + spring-5-security/pom.xml | 1 + spring-5/pom.xml | 1 + spring-activiti/pom.xml | 1 + spring-boot-autoconfiguration/pom.xml | 1 + spring-boot-bootstrap/pom.xml | 1 + spring-boot-ops/pom.xml | 1 + spring-boot/.factorypath | 28 +- spring-boot/pom.xml | 1 + spring-cloud/spring-cloud-aws/pom.xml | 1 + .../spring-cloud-connectors-heroku/pom.xml | 1 + spring-jenkins-pipeline/pom.xml | 1 + spring-jersey/pom.xml | 1 + spring-ldap/pom.xml | 1 + spring-mvc-forms-thymeleaf/pom.xml | 1 + spring-mvc-java/pom.xml | 1 + spring-mvc-velocity/pom.xml | 1 + spring-rest-embedded-tomcat/pom.xml | 1 + spring-rest-full/pom.xml | 1 + spring-rest-query-language/pom.xml | 1 + spring-rest-simple/pom.xml | 2 + spring-rest/pom.xml | 1 + spring-security-mvc-boot/pom.xml | 1 + .../spring-security-x509-basic-auth/pom.xml | 1 + .../spring-security-x509-client-auth/pom.xml | 2 + spring-vertx/pom.xml | 1 + 44 files changed, 360 insertions(+), 338 deletions(-) diff --git a/.gitignore b/.gitignore index 51f3d69d9f..e78c1e7e24 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,9 @@ spring-check-if-a-property-is-null/.mvn/wrapper/maven-wrapper.properties *.springBeans 20171220-JMeter.csv + +.factorypath +dependency-reduced-pom.xml +*.so +*.dylib +*.dll diff --git a/core-java-io/pom.xml b/core-java-io/pom.xml index 21e931656d..a98b489d9d 100644 --- a/core-java-io/pom.xml +++ b/core-java-io/pom.xml @@ -220,6 +220,7 @@ **/*LiveTest.java **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java @@ -289,6 +290,7 @@ **/*IntegrationTest.java + **/*IntTest.java diff --git a/core-java-sun/pom.xml b/core-java-sun/pom.xml index 3fd8e80296..8662884095 100644 --- a/core-java-sun/pom.xml +++ b/core-java-sun/pom.xml @@ -353,6 +353,7 @@ **/*IntegrationTest.java + **/*IntTest.java diff --git a/core-java/pom.xml b/core-java/pom.xml index f7a2139d99..a823d836e8 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -222,6 +222,7 @@ **/*LiveTest.java **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java @@ -387,6 +388,7 @@ **/*IntegrationTest.java + **/*IntTest.java diff --git a/custom-pmd-0.0.1.jar b/custom-pmd-0.0.1.jar index 5038a704752743a87999b917976d11c78b322af1..e19bce6e52a4b43fc383cbb5f176c57b6c99bd95 100644 GIT binary patch literal 4357 zcmeHKdpuNWAD<$`=oQwkOD*M+$;`TqvLWL#E;Ft(ZZ%}mU^0v~hN)?jQbI0~%ch95 zR=I`@BDr59lw60bTw1w|#UkD_tMIDzzPLtYBT&uSG=P#qrbUsJ4ah#V}FrWM{YR-qVs--cue z2j}t$qJR$}mO>~?OqovDj-WcxG~Uu6LfRSL>a*2nV+8o+iyY)TC66e~fM4_ThtdjZ zg`kh_fk0E6qWITF_uTP51dp{?J{6YyRG94L0y~K(kWNuOTwtE=r?${O_&;bnQ7PVJ zcj(qYoB$ADcMDVeA0$3{wuR{K&7vD^^Zc1Fv^9Jp9}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T``( z0OQmEfW)r}xw$%neVv`2!rEQ_6a!TsUsh(*EIGNvca1`AMuZH=s}*?mwUAm5&^(-1 zOWWH3Hx5k@GBxDQzCYJAG?YHG7*QZIUz>a-y-jtvd*RY7?(j5v(ClQPK){SvGKaD< zWa@aiN~#y)qn>g3;`GX$m^VS|aO}`jX6zBm>sA+-c#3n-D{CHQ4renfu{__h*t}F* z@p0z5;(9WXR~da~GyT zz}+1t|BX|DImx%Ydwpr^oa2VYs85z0D9}>S02yj%4!d!DQD3p1qTFX?b*o;cVIWZ3 z=sC9n2!HCKwg}J#odmINu0{7CVciw|tZ?m*8WzdR98n;0fv)nSs?ng1VLAZ(2b#{`HmHS1y?vvox2=BP$wckP>iZQ<<;2@l4$0Wgm3G;x`!--aB(- zquw)3uXqR^=ZF(f3d82Q*eyLvh+Vm`a6)Zh64Ams8a$Z#8VT017Je?9f3>x-W9GqH zOXe0CY4y{74>%QXZO*t6RuGbK$p89Ea`SL?v++RM+jw%e)&c9q=mD<-vhkp|L%qhK z;%`m)d_9!oip%KD6fm|E<3bkWjxG(nCIWT1AR4ZQL8%olU(Oc3UN;MG}U1 zC8n+IA~I$PLn4FZAq4mNIhB~cwu?w*B-p{ zlB9Ek?*E$b4=diC!-KcvuKpzLzfZ%S#) allowedEndings = Arrays.asList( "IntegrationTest", + "IntTest", "ManualTest", "JdbcTest", "LiveTest", diff --git a/jaxb/src/main/java/com/baeldung/jaxb/gen/ObjectFactory.java b/jaxb/src/main/java/com/baeldung/jaxb/gen/ObjectFactory.java index 0a3da677ce..26cd5814ac 100644 --- a/jaxb/src/main/java/com/baeldung/jaxb/gen/ObjectFactory.java +++ b/jaxb/src/main/java/com/baeldung/jaxb/gen/ObjectFactory.java @@ -1,48 +1,48 @@ - -package com.baeldung.jaxb.gen; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.baeldung.jaxb.gen package. - *

    An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.jaxb.gen - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link UserRequest } - * - */ - public UserRequest createUserRequest() { - return new UserRequest(); - } - - /** - * Create an instance of {@link UserResponse } - * - */ - public UserResponse createUserResponse() { - return new UserResponse(); - } - -} + +package com.baeldung.jaxb.gen; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.baeldung.jaxb.gen package. + *

    An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.baeldung.jaxb.gen + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link UserRequest } + * + */ + public UserRequest createUserRequest() { + return new UserRequest(); + } + + /** + * Create an instance of {@link UserResponse } + * + */ + public UserResponse createUserResponse() { + return new UserResponse(); + } + +} diff --git a/jaxb/src/main/java/com/baeldung/jaxb/gen/UserRequest.java b/jaxb/src/main/java/com/baeldung/jaxb/gen/UserRequest.java index 1c1abc61a6..4cfbeb8d46 100644 --- a/jaxb/src/main/java/com/baeldung/jaxb/gen/UserRequest.java +++ b/jaxb/src/main/java/com/baeldung/jaxb/gen/UserRequest.java @@ -1,87 +1,87 @@ - -package com.baeldung.jaxb.gen; - -import java.io.Serializable; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

    Java class for UserRequest complex type. - * - *

    The following schema fragment specifies the expected content contained within this class. - * - *

    - * <complexType name="UserRequest">
    - *   <complexContent>
    - *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    - *       <sequence>
    - *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
    - *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *       </sequence>
    - *     </restriction>
    - *   </complexContent>
    - * </complexType>
    - * 
    - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UserRequest", propOrder = { - "id", - "name" -}) -@XmlRootElement(name = "userRequest") -public class UserRequest - implements Serializable -{ - - private final static long serialVersionUID = -1L; - protected int id; - @XmlElement(required = true) - protected String name; - - /** - * Gets the value of the id property. - * - */ - public int getId() { - return id; - } - - /** - * Sets the value of the id property. - * - */ - public void setId(int value) { - this.id = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - -} + +package com.baeldung.jaxb.gen; + +import java.io.Serializable; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

    Java class for UserRequest complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType name="UserRequest">
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <sequence>
    + *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
    + *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
    + *       </sequence>
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "UserRequest", propOrder = { + "id", + "name" +}) +@XmlRootElement(name = "userRequest") +public class UserRequest + implements Serializable +{ + + private final static long serialVersionUID = -1L; + protected int id; + @XmlElement(required = true) + protected String name; + + /** + * Gets the value of the id property. + * + */ + public int getId() { + return id; + } + + /** + * Sets the value of the id property. + * + */ + public void setId(int value) { + this.id = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + +} diff --git a/jaxb/src/main/java/com/baeldung/jaxb/gen/UserResponse.java b/jaxb/src/main/java/com/baeldung/jaxb/gen/UserResponse.java index b80405e4a9..d86778403a 100644 --- a/jaxb/src/main/java/com/baeldung/jaxb/gen/UserResponse.java +++ b/jaxb/src/main/java/com/baeldung/jaxb/gen/UserResponse.java @@ -1,149 +1,149 @@ - -package com.baeldung.jaxb.gen; - -import java.io.Serializable; -import java.util.Calendar; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import org.w3._2001.xmlschema.Adapter1; - - -/** - *

    Java class for UserResponse complex type. - * - *

    The following schema fragment specifies the expected content contained within this class. - * - *

    - * <complexType name="UserResponse">
    - *   <complexContent>
    - *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    - *       <sequence>
    - *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
    - *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *         <element name="gender" type="{http://www.w3.org/2001/XMLSchema}string"/>
    - *         <element name="created" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
    - *       </sequence>
    - *     </restriction>
    - *   </complexContent>
    - * </complexType>
    - * 
    - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "UserResponse", propOrder = { - "id", - "name", - "gender", - "created" -}) -@XmlRootElement(name = "userResponse") -public class UserResponse - implements Serializable -{ - - private final static long serialVersionUID = -1L; - protected int id; - @XmlElement(required = true) - protected String name; - @XmlElement(required = true) - protected String gender; - @XmlElement(required = true, type = String.class) - @XmlJavaTypeAdapter(Adapter1 .class) - @XmlSchemaType(name = "dateTime") - protected Calendar created; - - /** - * Gets the value of the id property. - * - */ - public int getId() { - return id; - } - - /** - * Sets the value of the id property. - * - */ - public void setId(int value) { - this.id = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the gender property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getGender() { - return gender; - } - - /** - * Sets the value of the gender property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setGender(String value) { - this.gender = value; - } - - /** - * Gets the value of the created property. - * - * @return - * possible object is - * {@link String } - * - */ - public Calendar getCreated() { - return created; - } - - /** - * Sets the value of the created property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCreated(Calendar value) { - this.created = value; - } - -} + +package com.baeldung.jaxb.gen; + +import java.io.Serializable; +import java.util.Calendar; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.w3._2001.xmlschema.Adapter1; + + +/** + *

    Java class for UserResponse complex type. + * + *

    The following schema fragment specifies the expected content contained within this class. + * + *

    + * <complexType name="UserResponse">
    + *   <complexContent>
    + *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
    + *       <sequence>
    + *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
    + *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
    + *         <element name="gender" type="{http://www.w3.org/2001/XMLSchema}string"/>
    + *         <element name="created" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
    + *       </sequence>
    + *     </restriction>
    + *   </complexContent>
    + * </complexType>
    + * 
    + * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "UserResponse", propOrder = { + "id", + "name", + "gender", + "created" +}) +@XmlRootElement(name = "userResponse") +public class UserResponse + implements Serializable +{ + + private final static long serialVersionUID = -1L; + protected int id; + @XmlElement(required = true) + protected String name; + @XmlElement(required = true) + protected String gender; + @XmlElement(required = true, type = String.class) + @XmlJavaTypeAdapter(Adapter1 .class) + @XmlSchemaType(name = "dateTime") + protected Calendar created; + + /** + * Gets the value of the id property. + * + */ + public int getId() { + return id; + } + + /** + * Sets the value of the id property. + * + */ + public void setId(int value) { + this.id = value; + } + + /** + * Gets the value of the name property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getName() { + return name; + } + + /** + * Sets the value of the name property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setName(String value) { + this.name = value; + } + + /** + * Gets the value of the gender property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getGender() { + return gender; + } + + /** + * Sets the value of the gender property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setGender(String value) { + this.gender = value; + } + + /** + * Gets the value of the created property. + * + * @return + * possible object is + * {@link String } + * + */ + public Calendar getCreated() { + return created; + } + + /** + * Sets the value of the created property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCreated(Calendar value) { + this.created = value; + } + +} diff --git a/jaxb/src/main/java/com/baeldung/jaxb/gen/package-info.java b/jaxb/src/main/java/com/baeldung/jaxb/gen/package-info.java index 639d00179c..6384eab27f 100644 --- a/jaxb/src/main/java/com/baeldung/jaxb/gen/package-info.java +++ b/jaxb/src/main/java/com/baeldung/jaxb/gen/package-info.java @@ -1,2 +1,2 @@ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.baeldung.com/jaxb/gen", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package com.baeldung.jaxb.gen; +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.baeldung.com/jaxb/gen", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.baeldung.jaxb.gen; diff --git a/jaxb/src/main/java/org/w3/_2001/xmlschema/Adapter1.java b/jaxb/src/main/java/org/w3/_2001/xmlschema/Adapter1.java index 54b3c360dc..b4865b5510 100644 --- a/jaxb/src/main/java/org/w3/_2001/xmlschema/Adapter1.java +++ b/jaxb/src/main/java/org/w3/_2001/xmlschema/Adapter1.java @@ -1,23 +1,23 @@ - -package org.w3._2001.xmlschema; - -import java.util.Calendar; -import javax.xml.bind.annotation.adapters.XmlAdapter; - -public class Adapter1 - extends XmlAdapter -{ - - - public Calendar unmarshal(String value) { - return (javax.xml.bind.DatatypeConverter.parseDateTime(value)); - } - - public String marshal(Calendar value) { - if (value == null) { - return null; - } - return (javax.xml.bind.DatatypeConverter.printDateTime(value)); - } - -} + +package org.w3._2001.xmlschema; + +import java.util.Calendar; +import javax.xml.bind.annotation.adapters.XmlAdapter; + +public class Adapter1 + extends XmlAdapter +{ + + + public Calendar unmarshal(String value) { + return (javax.xml.bind.DatatypeConverter.parseDateTime(value)); + } + + public String marshal(Calendar value) { + if (value == null) { + return null; + } + return (javax.xml.bind.DatatypeConverter.printDateTime(value)); + } + +} diff --git a/mustache/pom.xml b/mustache/pom.xml index 88d87758cd..40fcecc4f8 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -95,6 +95,7 @@ **/*IntegrationTest.java + **/*IntTest.java @@ -125,6 +126,7 @@ **/*LiveTest.java **/*IntegrationTest.java + **/*IntTest.java **/AutoconfigurationTest.java diff --git a/parent-boot-1/pom.xml b/parent-boot-1/pom.xml index af14d88aff..bd28f7c5e2 100644 --- a/parent-boot-1/pom.xml +++ b/parent-boot-1/pom.xml @@ -47,6 +47,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java **/*LiveTest.java @@ -88,8 +89,8 @@ **/*IntegrationTest.java - */EthControllerTestOne.java **/*IntTest.java + */EthControllerTestOne.java **/*EntryPointsTest.java diff --git a/parent-boot-2/pom.xml b/parent-boot-2/pom.xml index 625a96ff9d..b62d37b3f0 100644 --- a/parent-boot-2/pom.xml +++ b/parent-boot-2/pom.xml @@ -48,6 +48,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java **/*LiveTest.java @@ -89,8 +90,8 @@ **/*IntegrationTest.java - */EthControllerTestOne.java **/*IntTest.java + */EthControllerTestOne.java **/*EntryPointsTest.java diff --git a/pom.xml b/pom.xml index 215da5d9d9..39419ec035 100644 --- a/pom.xml +++ b/pom.xml @@ -348,6 +348,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java **/JdbcTest.java @@ -473,6 +474,7 @@ **/*IntegrationTest.java + **/*IntTest.java diff --git a/resteasy/pom.xml b/resteasy/pom.xml index 61c099f110..aca9fe3635 100644 --- a/resteasy/pom.xml +++ b/resteasy/pom.xml @@ -98,6 +98,7 @@ **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-5-mvc/pom.xml b/spring-5-mvc/pom.xml index 711463c430..ae9ceb990a 100644 --- a/spring-5-mvc/pom.xml +++ b/spring-5-mvc/pom.xml @@ -145,6 +145,7 @@ false **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index e9e7c7c3e3..ca1cbc475a 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -155,6 +155,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-5-reactive/pom.xml b/spring-5-reactive/pom.xml index 8b40ccee00..6bec7f18cc 100644 --- a/spring-5-reactive/pom.xml +++ b/spring-5-reactive/pom.xml @@ -171,6 +171,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index 96cbff8938..f6d0ef8b4a 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -81,6 +81,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-5/pom.xml b/spring-5/pom.xml index bbd5272ae1..6e66fe1e99 100644 --- a/spring-5/pom.xml +++ b/spring-5/pom.xml @@ -175,6 +175,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml index 5b6911a450..edabb502dd 100644 --- a/spring-activiti/pom.xml +++ b/spring-activiti/pom.xml @@ -59,6 +59,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java **/JdbcTest.java diff --git a/spring-boot-autoconfiguration/pom.xml b/spring-boot-autoconfiguration/pom.xml index 2687fcd969..2a61b89b5d 100644 --- a/spring-boot-autoconfiguration/pom.xml +++ b/spring-boot-autoconfiguration/pom.xml @@ -79,6 +79,7 @@ **/*LiveTest.java **/*IntegrationTest.java + **/*IntTest.java **/AutoconfigurationTest.java diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml index ff5bca615b..9ba4d9a5eb 100644 --- a/spring-boot-bootstrap/pom.xml +++ b/spring-boot-bootstrap/pom.xml @@ -72,6 +72,7 @@ **/*LiveTest.java **/*IntegrationTest.java + **/*IntTest.java **/AutoconfigurationTest.java diff --git a/spring-boot-ops/pom.xml b/spring-boot-ops/pom.xml index dce826dbb5..21a7d22077 100644 --- a/spring-boot-ops/pom.xml +++ b/spring-boot-ops/pom.xml @@ -163,6 +163,7 @@ **/*LiveTest.java **/*IntegrationTest.java + **/*IntTest.java **/AutoconfigurationTest.java diff --git a/spring-boot/.factorypath b/spring-boot/.factorypath index 88c3910e93..68b2514aab 100644 --- a/spring-boot/.factorypath +++ b/spring-boot/.factorypath @@ -49,8 +49,6 @@ - - @@ -70,22 +68,11 @@ - - - - - - - - - - - @@ -98,22 +85,10 @@ - - - - - - - - - - - - - + @@ -149,7 +124,6 @@ - diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index c1b21b9b5e..d8ee3cc2d9 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -170,6 +170,7 @@ **/*LiveTest.java **/*IntegrationTest.java + **/*IntTest.java **/AutoconfigurationTest.java diff --git a/spring-cloud/spring-cloud-aws/pom.xml b/spring-cloud/spring-cloud-aws/pom.xml index 2d2c29e53e..d076dc5e8e 100644 --- a/spring-cloud/spring-cloud-aws/pom.xml +++ b/spring-cloud/spring-cloud-aws/pom.xml @@ -66,6 +66,7 @@ **/*IntegrationTest.java + **/*IntTest.java diff --git a/spring-cloud/spring-cloud-connectors-heroku/pom.xml b/spring-cloud/spring-cloud-connectors-heroku/pom.xml index 9b5d7c91d9..0363962c95 100644 --- a/spring-cloud/spring-cloud-connectors-heroku/pom.xml +++ b/spring-cloud/spring-cloud-connectors-heroku/pom.xml @@ -65,6 +65,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java **/JdbcTest.java diff --git a/spring-jenkins-pipeline/pom.xml b/spring-jenkins-pipeline/pom.xml index 6d26d18f96..9c3b6f14ed 100644 --- a/spring-jenkins-pipeline/pom.xml +++ b/spring-jenkins-pipeline/pom.xml @@ -55,6 +55,7 @@ **/*IntegrationTest.java + **/*IntTest.java diff --git a/spring-jersey/pom.xml b/spring-jersey/pom.xml index 4a37f4b2ab..5fb4adcc61 100644 --- a/spring-jersey/pom.xml +++ b/spring-jersey/pom.xml @@ -127,6 +127,7 @@ **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-ldap/pom.xml b/spring-ldap/pom.xml index 2f806e89f8..41683d32a1 100644 --- a/spring-ldap/pom.xml +++ b/spring-ldap/pom.xml @@ -127,6 +127,7 @@ **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-mvc-forms-thymeleaf/pom.xml b/spring-mvc-forms-thymeleaf/pom.xml index 59130a0133..31e5b6cd48 100644 --- a/spring-mvc-forms-thymeleaf/pom.xml +++ b/spring-mvc-forms-thymeleaf/pom.xml @@ -58,6 +58,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index f1c2b0b9f5..14ced24da7 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -207,6 +207,7 @@ **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-mvc-velocity/pom.xml b/spring-mvc-velocity/pom.xml index 330de252e7..077d55c2de 100644 --- a/spring-mvc-velocity/pom.xml +++ b/spring-mvc-velocity/pom.xml @@ -112,6 +112,7 @@ true **/*IntegrationTest.java + **/*IntTest.java diff --git a/spring-rest-embedded-tomcat/pom.xml b/spring-rest-embedded-tomcat/pom.xml index 0bb947f96d..8fbecb86e8 100644 --- a/spring-rest-embedded-tomcat/pom.xml +++ b/spring-rest-embedded-tomcat/pom.xml @@ -74,6 +74,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java **/JdbcTest.java diff --git a/spring-rest-full/pom.xml b/spring-rest-full/pom.xml index 2beff519c0..1df22faddd 100644 --- a/spring-rest-full/pom.xml +++ b/spring-rest-full/pom.xml @@ -286,6 +286,7 @@ **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-rest-query-language/pom.xml b/spring-rest-query-language/pom.xml index c16c6b583d..398181c1c8 100644 --- a/spring-rest-query-language/pom.xml +++ b/spring-rest-query-language/pom.xml @@ -305,6 +305,7 @@ **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-rest-simple/pom.xml b/spring-rest-simple/pom.xml index e774dc6ad9..36ee39ab27 100644 --- a/spring-rest-simple/pom.xml +++ b/spring-rest-simple/pom.xml @@ -227,6 +227,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java **/JdbcTest.java @@ -282,6 +283,7 @@ **/*IntegrationTest.java + **/*IntTest.java diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml index d56eb9949b..2b6b663b2a 100644 --- a/spring-rest/pom.xml +++ b/spring-rest/pom.xml @@ -253,6 +253,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java **/*LiveTest.java diff --git a/spring-security-mvc-boot/pom.xml b/spring-security-mvc-boot/pom.xml index fe95461eab..3b1796b978 100644 --- a/spring-security-mvc-boot/pom.xml +++ b/spring-security-mvc-boot/pom.xml @@ -211,6 +211,7 @@ **/*LiveTest.java **/*IntegrationTest.java + **/*IntTest.java **/*EntryPointsTest.java diff --git a/spring-security-x509/spring-security-x509-basic-auth/pom.xml b/spring-security-x509/spring-security-x509-basic-auth/pom.xml index 67a7e29e6f..56600302e0 100644 --- a/spring-security-x509/spring-security-x509-basic-auth/pom.xml +++ b/spring-security-x509/spring-security-x509-basic-auth/pom.xml @@ -30,6 +30,7 @@ **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java diff --git a/spring-security-x509/spring-security-x509-client-auth/pom.xml b/spring-security-x509/spring-security-x509-client-auth/pom.xml index 7dd919973d..ea5521c93d 100644 --- a/spring-security-x509/spring-security-x509-client-auth/pom.xml +++ b/spring-security-x509/spring-security-x509-client-auth/pom.xml @@ -30,6 +30,7 @@ **/*IntegrationTest.java + **/*IntTest.java **/*LiveTest.java @@ -57,6 +58,7 @@ **/*IntegrationTest.java + **/*IntTest.java diff --git a/spring-vertx/pom.xml b/spring-vertx/pom.xml index 0d535f79e4..449e94b15e 100644 --- a/spring-vertx/pom.xml +++ b/spring-vertx/pom.xml @@ -66,6 +66,7 @@ true **/*IntegrationTest.java + **/*IntTest.java **/*LongRunningUnitTest.java **/*ManualTest.java **/JdbcTest.java From 550806ab32be2cbcb9b4be7440a28880208b40ae Mon Sep 17 00:00:00 2001 From: tamasradu Date: Fri, 22 Jun 2018 18:15:08 +0300 Subject: [PATCH 17/18] Adding code for BAEL-1845 (#4524) --- .../baeldung/jodatime/JodaTimeUnitTest.java | 190 ++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 libraries/src/test/java/com/baeldung/jodatime/JodaTimeUnitTest.java diff --git a/libraries/src/test/java/com/baeldung/jodatime/JodaTimeUnitTest.java b/libraries/src/test/java/com/baeldung/jodatime/JodaTimeUnitTest.java new file mode 100644 index 0000000000..3cf4f739e8 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/jodatime/JodaTimeUnitTest.java @@ -0,0 +1,190 @@ +package com.baeldung.jodatime; + +import org.joda.time.*; +import org.joda.time.format.DateTimeFormat; +import org.joda.time.format.DateTimeFormatter; +import org.junit.Test; + +import java.util.Date; +import java.util.TimeZone; + +import static org.junit.Assert.*; + +public class JodaTimeUnitTest { + + @Test + public void testDateTimeRepresentation() { + + DateTimeZone.setDefault(DateTimeZone.forID("Europe/Bucharest")); + + // representing current date and time + LocalDate currentDate = LocalDate.now(); + LocalTime currentTime = LocalTime.now(); + LocalDateTime currentLocalDateTime = LocalDateTime.now(); + + LocalDateTime currentDateTimeFromJavaDate = new LocalDateTime(new Date()); + Date currentJavaDate = currentDateTimeFromJavaDate.toDate(); + + // representing custom date and time + Date oneMinuteAgoDate = new Date(System.currentTimeMillis() - (60 * 1000)); + Instant oneMinutesAgoInstant = new Instant(oneMinuteAgoDate); + + DateTime customDateTimeFromInstant = new DateTime(oneMinutesAgoInstant); + DateTime customDateTimeFromJavaDate = new DateTime(oneMinuteAgoDate); + DateTime customDateTimeFromString = new DateTime("2018-05-05T10:11:12.123"); + DateTime customDateTimeFromParts = new DateTime(2018, 5, 5, 10, 11, 12, 123); + + // parsing + DateTime parsedDateTime = DateTime.parse("2018-05-05T10:11:12.123"); + assertEquals("2018-05-05T10:11:12.123+03:00", parsedDateTime.toString()); + + DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("MM/dd/yyyy HH:mm:ss"); + DateTime parsedDateTimeUsingFormatter = DateTime.parse("05/05/2018 10:11:12", dateTimeFormatter); + assertEquals("2018-05-05T10:11:12.000+03:00", parsedDateTimeUsingFormatter.toString()); + + // Instant + Instant instant = new Instant(); + Instant.now(); + + Instant instantFromString = new Instant("2018-05-05T10:11:12"); + Instant instantFromDate = new Instant(oneMinuteAgoDate); + Instant instantFromTimestamp = new Instant(System.currentTimeMillis() - (60 * 1000)); + Instant parsedInstant = Instant.parse("05/05/2018 10:11:12", dateTimeFormatter); + + Instant instantNow = Instant.now(); + Instant oneMinuteAgoInstant = new Instant(oneMinuteAgoDate); + + // epochMilli and epochSecond + long milliesFromEpochTime = System.currentTimeMillis(); + long secondsFromEpochTime = milliesFromEpochTime / 1000; + Instant instantFromEpochMilli = Instant.ofEpochMilli(milliesFromEpochTime); + Instant instantFromEpocSeconds = Instant.ofEpochSecond(secondsFromEpochTime); + + // convert Instants + DateTime dateTimeFromInstant = instant.toDateTime(); + Date javaDateFromInstant = instant.toDate(); + + int year = instant.get(DateTimeFieldType.year()); + int month = instant.get(DateTimeFieldType.monthOfYear()); + int day = instant.get(DateTimeFieldType.dayOfMonth()); + int hour = instant.get(DateTimeFieldType.hourOfDay()); + + // Duration, Period, Instant + long currentTimestamp = System.currentTimeMillis(); + long oneHourAgo = currentTimestamp - 24*60*1000; + + Duration duration = new Duration(oneHourAgo, currentTimestamp); + Instant.now().plus(duration); + + long durationInDays = duration.getStandardDays(); + long durationInHours = duration.getStandardHours(); + long durationInMinutes = duration.getStandardMinutes(); + long durationInSeconds = duration.getStandardSeconds(); + long durationInMilli = duration.getMillis(); + + // converting between classes + DateTimeUtils.setCurrentMillisFixed(currentTimestamp); + LocalDateTime currentDateAndTime = LocalDateTime.now(); + + assertEquals(currentTimestamp, currentDateAndTime.toDate().getTime()); + assertEquals(new DateTime(currentTimestamp), currentDateAndTime.toDateTime()); + assertEquals(new LocalDate(currentTimestamp), currentDateAndTime.toLocalDate()); + assertEquals(new LocalTime(currentTimestamp), currentDateAndTime.toLocalTime()); + } + + @Test + public void testJodaInstant() { + + Date oneMinuteAgoDate = new Date(System.currentTimeMillis() - (60 * 1000)); + + Instant instantNow = Instant.now(); + Instant oneMinuteAgoInstant = new Instant(oneMinuteAgoDate); + + assertTrue(instantNow.compareTo(oneMinuteAgoInstant) > 0); + assertTrue(instantNow.isAfter(oneMinuteAgoInstant)); + assertTrue(oneMinuteAgoInstant.isBefore(instantNow)); + assertTrue(oneMinuteAgoInstant.isBeforeNow()); + assertFalse(oneMinuteAgoInstant.isEqual(instantNow)); + + LocalDateTime localDateTime = new LocalDateTime("2018-02-01"); + Period period = new Period().withMonths(1); + LocalDateTime datePlusPeriod = localDateTime.plus(period); + + Instant startInterval1 = new Instant("2018-05-05T09:00:00.000"); + Instant endInterval1 = new Instant("2018-05-05T11:00:00.000"); + Interval interval1 = new Interval(startInterval1, endInterval1); + + Instant startInterval2 = new Instant("2018-05-05T10:00:00.000"); + Instant endInterval2 = new Instant("2018-05-05T11:00:00.000"); + Interval interval2 = new Interval(startInterval2, endInterval2); + + Instant startInterval3 = new Instant("2018-05-05T11:00:00.000"); + Instant endInterval3 = new Instant("2018-05-05T13:00:00.000"); + Interval interval3 = new Interval(startInterval3, endInterval3); + + Interval overlappingInterval = interval1.overlap(interval2); + Interval notOverlappingInterval = interval1.overlap(interval3); + + assertTrue(overlappingInterval.isEqual(new Interval(new Instant("2018-05-05T10:00:00.000"), new Instant("2018-05-05T11:00:00.000")))); + assertNotNull(overlappingInterval); + + interval1.abuts(interval3); + assertTrue(interval1.abuts(new Interval(new Instant("2018-05-05T11:00:00.000"), new Instant("2018-05-05T13:00:00.000")))); + + interval1.gap(interval2); + } + + + @Test + public void testDateTimeOperations() { + + DateTimeUtils.setCurrentMillisFixed(1529612783288L); + DateTimeZone.setDefault(DateTimeZone.UTC); + + LocalDateTime currentLocalDateTime = LocalDateTime.now(); + assertEquals("2018-06-21T20:26:23.288", currentLocalDateTime.toString()); + + LocalDateTime nextDayDateTime = currentLocalDateTime.plusDays(1); + assertEquals("2018-06-22T20:26:23.288", nextDayDateTime.toString()); + + Period oneMonth = new Period().withMonths(1); + LocalDateTime nextMonthDateTime = currentLocalDateTime.plus(oneMonth); + assertEquals("2018-07-21T20:26:23.288", nextMonthDateTime.toString()); + + LocalDateTime previousDayLocalDateTime = currentLocalDateTime.minusDays(1); + assertEquals("2018-06-20T20:26:23.288", previousDayLocalDateTime.toString()); + + LocalDateTime currentDateAtHour10 = currentLocalDateTime + .withHourOfDay(0) + .withMinuteOfHour(0) + .withSecondOfMinute(0) + .withMillisOfSecond(0); + assertEquals("2018-06-21T00:00:00.000", currentDateAtHour10.toString()); + } + + @Test + public void testTimezones() { + + System.getProperty("user.timezone"); + DateTimeZone.getAvailableIDs(); + // DateTimeZone.setDefault(DateTimeZone.forID("Europe/Bucharest")); + + DateTimeUtils.setCurrentMillisFixed(1529612783288L); + + DateTime dateTimeInChicago = new DateTime(DateTimeZone.forID("America/Chicago")); + assertEquals("2018-06-21T15:26:23.288-05:00", dateTimeInChicago.toString()); + + DateTime dateTimeInBucharest = new DateTime(DateTimeZone.forID("Europe/Bucharest")); + assertEquals("2018-06-21T23:26:23.288+03:00", dateTimeInBucharest.toString()); + + LocalDateTime localDateTimeInChicago = new LocalDateTime(DateTimeZone.forID("America/Chicago")); + assertEquals("2018-06-21T15:26:23.288", localDateTimeInChicago.toString()); + + DateTime convertedDateTime = localDateTimeInChicago.toDateTime(DateTimeZone.forID("Europe/Bucharest")); + assertEquals("2018-06-21T15:26:23.288+03:00", convertedDateTime.toString()); + + Date convertedDate = localDateTimeInChicago.toDate(TimeZone.getTimeZone("Europe/Bucharest")); + assertEquals("Thu Jun 21 15:26:23 EEST 2018", convertedDate.toString()); + } + +} From 0242d74b936e4c8e647761548f5925a29d07f11d Mon Sep 17 00:00:00 2001 From: Jonathan Cook Date: Sat, 23 Jun 2018 17:11:52 +0200 Subject: [PATCH 18/18] BAEL-1863 - Calling Callbacks with Mockito (#4531) * BAEL-1849 - Convert from String to Date in Java * BAEL-1863 - Calling Callbacks with Mockito --- .../mockito/service/ActionHandler.java | 26 ++++++++ .../baeldung/mockito/service/Callback.java | 6 ++ .../org/baeldung/mockito/service/Data.java | 15 +++++ .../baeldung/mockito/service/Response.java | 24 +++++++ .../org/baeldung/mockito/service/Service.java | 7 ++ .../service/ActionHandlerUnitTest.java | 65 +++++++++++++++++++ 6 files changed, 143 insertions(+) create mode 100644 testing-modules/mockito/src/main/java/org/baeldung/mockito/service/ActionHandler.java create mode 100644 testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Callback.java create mode 100644 testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Data.java create mode 100644 testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Response.java create mode 100644 testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Service.java create mode 100644 testing-modules/mockito/src/test/java/org/baeldung/mockito/service/ActionHandlerUnitTest.java diff --git a/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/ActionHandler.java b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/ActionHandler.java new file mode 100644 index 0000000000..289dcff399 --- /dev/null +++ b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/ActionHandler.java @@ -0,0 +1,26 @@ +package org.baeldung.mockito.service; + +public class ActionHandler { + + private Service service; + + public ActionHandler(Service service) { + this.service = service; + } + + public void doAction() { + service.doAction("our-request", new Callback() { + @Override + public void reply(Response response) { + handleResponse(response); + } + }); + } + + private void handleResponse(Response response) { + if (response.isValid()) { + response.setData(new Data("Successful data response")); + } + } + +} diff --git a/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Callback.java b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Callback.java new file mode 100644 index 0000000000..fb8d01ce2e --- /dev/null +++ b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Callback.java @@ -0,0 +1,6 @@ +package org.baeldung.mockito.service; + +public interface Callback { + + void reply(T response); +} diff --git a/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Data.java b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Data.java new file mode 100644 index 0000000000..665c05382c --- /dev/null +++ b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Data.java @@ -0,0 +1,15 @@ +package org.baeldung.mockito.service; + +public class Data { + + private String message; + + public Data(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + +} diff --git a/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Response.java b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Response.java new file mode 100644 index 0000000000..22474a5ba7 --- /dev/null +++ b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Response.java @@ -0,0 +1,24 @@ +package org.baeldung.mockito.service; + +public class Response { + + private Data data; + private boolean isValid = true; + + public boolean isValid() { + return isValid; + } + + public void setIsValid(boolean isValid) { + this.isValid = isValid; + } + + public void setData(Data data) { + this.data = data; + } + + public Data getData() { + return data; + } + +} diff --git a/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Service.java b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Service.java new file mode 100644 index 0000000000..63434e53fb --- /dev/null +++ b/testing-modules/mockito/src/main/java/org/baeldung/mockito/service/Service.java @@ -0,0 +1,7 @@ +package org.baeldung.mockito.service; + +public interface Service { + + void doAction(String request, Callback callback); + +} diff --git a/testing-modules/mockito/src/test/java/org/baeldung/mockito/service/ActionHandlerUnitTest.java b/testing-modules/mockito/src/test/java/org/baeldung/mockito/service/ActionHandlerUnitTest.java new file mode 100644 index 0000000000..c34a9a4a09 --- /dev/null +++ b/testing-modules/mockito/src/test/java/org/baeldung/mockito/service/ActionHandlerUnitTest.java @@ -0,0 +1,65 @@ +package org.baeldung.mockito.service; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.stubbing.Answer; + +public class ActionHandlerUnitTest { + + @Mock + private Service service; + + @Captor + private ArgumentCaptor> callbackCaptor; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void givenServiceWithValidResponse_whenCallbackReceived_thenProcessed() { + ActionHandler handler = new ActionHandler(service); + handler.doAction(); + + verify(service).doAction(anyString(), callbackCaptor.capture()); + + Callback callback = callbackCaptor.getValue(); + Response response = new Response(); + callback.reply(response); + + String expectedMessage = "Successful data response"; + Data data = response.getData(); + assertEquals("Should receive a successful message: ", expectedMessage, data.getMessage()); + } + + @Test + public void givenServiceWithInvalidResponse_whenCallbackReceived_thenNotProcessed() { + Response response = new Response(); + response.setIsValid(false); + + doAnswer((Answer) invocation -> { + Callback callback = invocation.getArgument(1); + callback.reply(response); + + Data data = response.getData(); + assertNull("No data in invalid response: ", data); + return null; + }).when(service) + .doAction(anyString(), any(Callback.class)); + + ActionHandler handler = new ActionHandler(service); + handler.doAction(); + } +}