diff --git a/apache-zookeeper/pom.xml b/apache-zookeeper/pom.xml
index 3a6fc1787b..b08da534a5 100644
--- a/apache-zookeeper/pom.xml
+++ b/apache-zookeeper/pom.xml
@@ -1,36 +1,23 @@
- 4.0.0
- com.baeldung
- apache-zookeeper
- 0.0.1-SNAPSHOT
- jar
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ 4.0.0
+ com.baeldung
+ apache-zookeeper
+ 0.0.1-SNAPSHOT
+ jar
-
- com.baeldung
- parent-modules
- 1.0.0-SNAPSHOT
-
-
-
-
- org.apache.zookeeper
- zookeeper
- 3.3.2
-
-
- com.sun.jmx
- jmxri
-
-
- com.sun.jdmk
- jmxtools
-
-
- javax.jms
- jms
-
-
-
-
+
+ com.baeldung
+ parent-modules
+ 1.0.0-SNAPSHOT
+
+
+
+
+ org.apache.zookeeper
+ zookeeper
+ 3.4.11
+
+
+
diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml
index 9d90ba2dbf..9b2981a747 100644
--- a/spring-mvc-java/pom.xml
+++ b/spring-mvc-java/pom.xml
@@ -1,5 +1,5 @@
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.baeldung
spring-mvc-java
@@ -7,38 +7,42 @@
spring-mvc-java
+ parent-boot-5
com.baeldung
- parent-modules
- 1.0.0-SNAPSHOT
+ 0.0.1-SNAPSHOT
+ ../parent-boot-5
-
+
- org.springframework
- spring-web
- ${org.springframework.version}
-
-
- commons-logging
- commons-logging
-
-
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
- org.springframework
- spring-webmvc
- ${org.springframework.version}
+ org.springframework.boot
+ spring-boot-starter-actuator
- org.springframework
- spring-websocket
- ${org.springframework.version}
+ org.springframework.boot
+ spring-boot-devtools
- org.springframework
- spring-messaging
- ${org.springframework.version}
+ org.springframework.boot
+ spring-boot-test
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-aop
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-websocket
@@ -63,11 +67,6 @@
-
- org.springframework
- spring-aop
- ${org.springframework.version}
-
org.aspectj
aspectjrt
@@ -118,7 +117,6 @@
org.springframework
spring-test
- ${org.springframework.version}
test
@@ -294,8 +292,6 @@
- 4.3.4.RELEASE
- 4.2.0.RELEASE
2.1.5.RELEASE
2.9.4
@@ -317,7 +313,7 @@
4.4.5
4.5.2
- 2.9.0
+ 3.0.7
2.23
diff --git a/spring-mvc-java/src/main/java/com/baeldung/app/Application.java b/spring-mvc-java/src/main/java/com/baeldung/app/Application.java
new file mode 100644
index 0000000000..301caffca9
--- /dev/null
+++ b/spring-mvc-java/src/main/java/com/baeldung/app/Application.java
@@ -0,0 +1,17 @@
+package com.baeldung.app;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.context.annotation.ComponentScan;
+
+@EnableAutoConfiguration
+@ComponentScan(value = {"com.baeldung.web.controller"}, resourcePattern = "**/FileUploadController.class")
+@SpringBootApplication
+public class Application extends SpringBootServletInitializer {
+
+ public static void main(final String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
\ No newline at end of file
diff --git a/testing-modules/mockito/src/main/java/org/baeldung/hamcrest/City.java b/testing-modules/mockito/src/main/java/org/baeldung/hamcrest/City.java
new file mode 100644
index 0000000000..d6369189c1
--- /dev/null
+++ b/testing-modules/mockito/src/main/java/org/baeldung/hamcrest/City.java
@@ -0,0 +1,41 @@
+package org.baeldung.hamcrest;
+
+public class City extends Location {
+ String name;
+ String state;
+
+ public City(String name, String state) {
+ this.name = name;
+ this.state = state;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ @Override
+ public String toString() {
+ if (this.name == null && this.state == null) return null;
+ StringBuilder sb = new StringBuilder();
+ sb.append("[");
+ sb.append("Name: ");
+ sb.append(this.name);
+ sb.append(", ");
+ sb.append("State: ");
+ sb.append(this.state);
+ sb.append("]");
+ return sb.toString();
+ }
+}
diff --git a/testing-modules/mockito/src/main/java/org/baeldung/hamcrest/Location.java b/testing-modules/mockito/src/main/java/org/baeldung/hamcrest/Location.java
new file mode 100644
index 0000000000..52561d07dc
--- /dev/null
+++ b/testing-modules/mockito/src/main/java/org/baeldung/hamcrest/Location.java
@@ -0,0 +1,4 @@
+package org.baeldung.hamcrest;
+
+public class Location {
+}
diff --git a/testing-modules/mockito/src/test/java/org/baeldung/hamcrest/HamcrestBeansUnitTest.java b/testing-modules/mockito/src/test/java/org/baeldung/hamcrest/HamcrestBeansUnitTest.java
new file mode 100644
index 0000000000..e7eb9bda1b
--- /dev/null
+++ b/testing-modules/mockito/src/test/java/org/baeldung/hamcrest/HamcrestBeansUnitTest.java
@@ -0,0 +1,91 @@
+package org.baeldung.hamcrest;
+
+import org.junit.Test;
+
+import java.beans.PropertyDescriptor;
+import java.util.Arrays;
+import java.util.List;
+
+import static java.util.stream.Collectors.toList;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasProperty;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.equalToIgnoringCase;
+import static org.hamcrest.Matchers.samePropertyValuesAs;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.beans.PropertyUtil.getPropertyDescriptor;
+import static org.hamcrest.beans.PropertyUtil.propertyDescriptorsFor;
+
+public class HamcrestBeansUnitTest {
+
+ @Test
+ public void givenACity_whenHasProperty_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+
+ assertThat(city, hasProperty("name"));
+ }
+
+ @Test
+ public void givenACity_whenNotHasProperty_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+
+ assertThat(city, not(hasProperty("country")));
+ }
+
+ @Test
+ public void givenACity_whenHasPropertyWithValueEqualTo_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+
+ assertThat(city, hasProperty("name", equalTo("San Francisco")));
+ }
+
+ @Test
+ public void givenACity_whenHasPropertyWithValueEqualToIgnoringCase_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+
+ assertThat(city, hasProperty("state", equalToIgnoringCase("ca")));
+ }
+
+ @Test
+ public void givenACity_whenSamePropertyValuesAs_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+ City city2 = new City("San Francisco", "CA");
+
+ assertThat(city, samePropertyValuesAs(city2));
+ }
+
+ @Test
+ public void givenACity_whenNotSamePropertyValuesAs_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+ City city2 = new City("Los Angeles", "CA");
+
+ assertThat(city, not(samePropertyValuesAs(city2)));
+ }
+
+ @Test
+ public void givenACity_whenGetPropertyDescriptor_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+ PropertyDescriptor descriptor = getPropertyDescriptor("state", city);
+
+ assertThat(descriptor
+ .getReadMethod()
+ .getName(), is(equalTo("getState")));
+ }
+
+ @Test
+ public void givenACity_whenGetPropertyDescriptorsFor_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+ PropertyDescriptor[] descriptors = propertyDescriptorsFor(city, Object.class);
+ List getters = Arrays
+ .stream(descriptors)
+ .map(x -> x
+ .getReadMethod()
+ .getName())
+ .collect(toList());
+
+ assertThat(getters, containsInAnyOrder("getName", "getState"));
+ }
+
+}
\ No newline at end of file
diff --git a/testing-modules/mockito/src/test/java/org/baeldung/hamcrest/HamcrestObjectUnitTest.java b/testing-modules/mockito/src/test/java/org/baeldung/hamcrest/HamcrestObjectUnitTest.java
new file mode 100644
index 0000000000..8d30ff297b
--- /dev/null
+++ b/testing-modules/mockito/src/test/java/org/baeldung/hamcrest/HamcrestObjectUnitTest.java
@@ -0,0 +1,57 @@
+package org.baeldung.hamcrest;
+
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasToString;
+import static org.hamcrest.Matchers.equalToIgnoringCase;
+import static org.hamcrest.Matchers.emptyOrNullString;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.typeCompatibleWith;
+import static org.hamcrest.Matchers.not;
+
+public class HamcrestObjectUnitTest {
+
+ @Test
+ public void givenACity_whenHasToString_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+
+ assertThat(city, hasToString("[Name: San Francisco, State: CA]"));
+ }
+
+ @Test
+ public void givenACity_whenHasToStringEqualToIgnoringCase_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+
+ assertThat(city, hasToString(equalToIgnoringCase("[NAME: SAN FRANCISCO, STATE: CA]")));
+ }
+
+ @Test
+ public void givenACity_whenHasToStringEmptyOrNullString_thenCorrect() {
+ City city = new City(null, null);
+
+ assertThat(city, hasToString(emptyOrNullString()));
+ }
+
+ @Test
+ public void givenACity_whenTypeCompatibleWithLocation_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+
+ assertThat(city.getClass(), is(typeCompatibleWith(Location.class)));
+ }
+
+ @Test
+ public void givenACity_whenTypeNotCompatibleWithString_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+
+ assertThat(city.getClass(), is(not(typeCompatibleWith(String.class))));
+ }
+
+ @Test
+ public void givenACity_whenTypeCompatibleWithObject_thenCorrect() {
+ City city = new City("San Francisco", "CA");
+
+ assertThat(city.getClass(), is(typeCompatibleWith(Object.class)));
+ }
+
+}