diff --git a/apache-cxf/cxf-introduction/pom.xml b/apache-cxf/cxf-introduction/pom.xml
index 9629dfda1b..0902bd690e 100644
--- a/apache-cxf/cxf-introduction/pom.xml
+++ b/apache-cxf/cxf-introduction/pom.xml
@@ -45,66 +45,5 @@
${cxf.version}
-
-
-
- live
-
-
-
- org.codehaus.cargo
- cargo-maven2-plugin
- 1.4.19
-
-
- tomcat8x
- embedded
-
-
-
- localhost
- 8082
-
-
-
-
-
- start-server
- pre-integration-test
-
- start
-
-
-
- stop-server
- post-integration-test
-
- stop
-
-
-
-
-
-
- maven-surefire-plugin
- ${surefire.version}
-
-
- integration-test
-
- test
-
-
-
- none
-
-
-
-
-
-
-
-
-
-
+
diff --git a/apache-cxf/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java b/apache-cxf/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java
index 1c50fcb9b6..60fc0a10e7 100644
--- a/apache-cxf/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java
+++ b/apache-cxf/cxf-introduction/src/test/java/com/baeldung/cxf/introduction/StudentLiveTest.java
@@ -21,7 +21,7 @@ public class StudentLiveTest {
{
service = Service.create(SERVICE_NAME);
- final String endpointAddress = "http://localhost:8082/cxf-introduction/baeldung";
+ final String endpointAddress = "http://localhost:8080/baeldung";
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
}
diff --git a/apache-cxf/cxf-jaxrs-implementation/pom.xml b/apache-cxf/cxf-jaxrs-implementation/pom.xml
index 24dad05a0f..b3a81aef82 100644
--- a/apache-cxf/cxf-jaxrs-implementation/pom.xml
+++ b/apache-cxf/cxf-jaxrs-implementation/pom.xml
@@ -52,66 +52,4 @@
${httpclient.version}
-
-
-
- live
-
-
-
- org.codehaus.cargo
- cargo-maven2-plugin
- 1.4.19
-
-
- tomcat8x
- embedded
-
-
-
- localhost
- 8082
-
-
-
-
-
- start-server
- pre-integration-test
-
- start
-
-
-
- stop-server
- post-integration-test
-
- stop
-
-
-
-
-
-
- maven-surefire-plugin
- ${surefire.version}
-
-
- integration-test
-
- test
-
-
-
- none
-
-
-
-
-
-
-
-
-
-
diff --git a/apache-cxf/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java b/apache-cxf/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java
index 692def81f5..29c34ae16b 100644
--- a/apache-cxf/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java
+++ b/apache-cxf/cxf-jaxrs-implementation/src/test/java/com/baeldung/cxf/jaxrs/implementation/ServiceLiveTest.java
@@ -21,7 +21,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class ServiceLiveTest {
- private static final String BASE_URL = "http://localhost:8082/baeldung/courses/";
+ private static final String BASE_URL = "http://localhost:8080/baeldung/courses/";
private static CloseableHttpClient client;
@BeforeClass
diff --git a/core-java-8/README.md b/core-java-8/README.md
deleted file mode 100644
index c130e6bd41..0000000000
--- a/core-java-8/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-=========
-
-## Core Java 8 Cookbooks and Examples
-
-### Relevant Articles:
-- [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda)
-- [Java – Directory Size](http://www.baeldung.com/java-folder-size)
-- [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources)
-- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial)
-- [Java 8 New Features](http://www.baeldung.com/java-8-new-features)
-- [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips)
-- [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator)
-- [Java 8 Streams Advanced](http://www.baeldung.com/java-8-streams)
-- [Java 8 Collectors](http://www.baeldung.com/java-8-collectors)
-- [Convert String to int or Integer in Java](http://www.baeldung.com/java-convert-string-to-int-or-integer)
-- [Convert char to String in Java](http://www.baeldung.com/java-convert-char-to-string)
-- [Guide to Java 8’s Functional Interfaces](http://www.baeldung.com/java-8-functional-interfaces)
-- [Guide To CompletableFuture](http://www.baeldung.com/java-completablefuture)
-- [Introduction to Thread Pools in Java](http://www.baeldung.com/thread-pool-java-and-guava)
-- [Guide to Java 8 Collectors](http://www.baeldung.com/java-8-collectors)
-- [The Java 8 Stream API Tutorial](http://www.baeldung.com/java-8-streams)
-- [New Features in Java 8](http://www.baeldung.com/java-8-new-features)
-- [Introduction to Java 8 Streams](http://www.baeldung.com/java-8-streams-introduction)
-- [Guide to the Fork/Join Framework in Java](http://www.baeldung.com/java-fork-join)
diff --git a/core-java-8/pom.xml b/core-java-8/pom.xml
deleted file mode 100644
index 22e3bab595..0000000000
--- a/core-java-8/pom.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-
- 4.0.0
-
- com.baeldung
- 1.0.0-SNAPSHOT
- core-java8
-
- core-java8
-
-
-
-
-
-
- commons-io
- commons-io
- 2.5
-
-
-
- com.google.guava
- guava
- ${guava.version}
-
-
-
- org.apache.commons
- commons-collections4
- 4.0
-
-
-
- commons-codec
- commons-codec
- 1.10
-
-
-
- org.apache.commons
- commons-lang3
- 3.3.2
-
-
-
- org.slf4j
- slf4j-api
- ${org.slf4j.version}
-
-
-
-
-
- org.hamcrest
- hamcrest-library
- ${org.hamcrest.version}
- test
-
-
-
- junit
- junit
- ${junit.version}
- test
-
-
-
- org.assertj
- assertj-core
- 3.5.1
- test
-
-
-
- org.mockito
- mockito-core
- ${mockito.version}
- test
-
-
-
-
-
- core-java-8
-
-
- src/main/resources
- true
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven-compiler-plugin.version}
-
- 1.8
- 1.8
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire-plugin.version}
-
-
-
-
-
-
-
-
- UTF-8
-
-
- 1.7.13
- 1.0.13
-
-
- 5.1.3.Final
-
-
- 19.0
- 3.4
-
-
- 1.3
- 4.12
- 1.10.19
-
-
- 3.5.1
- 2.6
- 2.19.1
- 2.7
-
-
-
-
\ No newline at end of file
diff --git a/core-java-8/src/main/java/.gitignore b/core-java-8/src/main/java/.gitignore
deleted file mode 100644
index 83c05e60c8..0000000000
--- a/core-java-8/src/main/java/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-*.class
-
-#folders#
-/target
-/neoDb*
-/data
-/src/main/webapp/WEB-INF/classes
-*/META-INF/*
-
-# Packaged files #
-*.jar
-*.war
-*.ear
\ No newline at end of file
diff --git a/core-java-8/src/main/java/com/baeldung/enums/Pizza.java b/core-java-8/src/main/java/com/baeldung/enums/Pizza.java
deleted file mode 100644
index 5bc2d9a9eb..0000000000
--- a/core-java-8/src/main/java/com/baeldung/enums/Pizza.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.baeldung.enums;
-
-import java.util.EnumMap;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class Pizza {
-
- private static EnumSet deliveredPizzaStatuses =
- EnumSet.of(PizzaStatusEnum.DELIVERED);
-
- private PizzaStatusEnum status;
-
- public enum PizzaStatusEnum {
- ORDERED(5) {
- @Override
- public boolean isOrdered() {
- return true;
- }
- },
- READY(2) {
- @Override
- public boolean isReady() {
- return true;
- }
- },
- DELIVERED(0) {
- @Override
- public boolean isDelivered() {
- return true;
- }
- };
-
- private int timeToDelivery;
-
- public boolean isOrdered() {
- return false;
- }
-
- public boolean isReady() {
- return false;
- }
-
- public boolean isDelivered() {
- return false;
- }
-
- public int getTimeToDelivery() {
- return timeToDelivery;
- }
-
- PizzaStatusEnum(int timeToDelivery) {
- this.timeToDelivery = timeToDelivery;
- }
- }
-
- public PizzaStatusEnum getStatus() {
- return status;
- }
-
- public void setStatus(PizzaStatusEnum status) {
- this.status = status;
- }
-
- public boolean isDeliverable() {
- return this.status.isReady();
- }
-
- public void printTimeToDeliver() {
- System.out.println("Time to delivery is " + this.getStatus().getTimeToDelivery() + " days");
- }
-
- public static List getAllUndeliveredPizzas(List input) {
- return input.stream().filter((s) -> !deliveredPizzaStatuses.contains(s.getStatus())).collect(Collectors.toList());
- }
-
- public static EnumMap> groupPizzaByStatus(List pzList) {
- return pzList.stream().collect(
- Collectors.groupingBy(Pizza::getStatus,
- () -> new EnumMap<>(PizzaStatusEnum.class), Collectors.toList()));
- }
-
- public void deliver() {
- if (isDeliverable()) {
- PizzaDeliverySystemConfiguration.getInstance().getDeliveryStrategy().deliver(this);
- this.setStatus(PizzaStatusEnum.DELIVERED);
- }
- }
-
-}
\ No newline at end of file
diff --git a/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java b/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java
deleted file mode 100644
index ed65919387..0000000000
--- a/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliveryStrategy.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.baeldung.enums;
-
-public enum PizzaDeliveryStrategy {
- EXPRESS {
- @Override
- public void deliver(Pizza pz) {
- System.out.println("Pizza will be delivered in express mode");
- }
- },
- NORMAL {
- @Override
- public void deliver(Pizza pz) {
- System.out.println("Pizza will be delivered in normal mode");
- }
- };
-
- public abstract void deliver(Pizza pz);
-}
diff --git a/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java b/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java
deleted file mode 100644
index 5ccff5e959..0000000000
--- a/core-java-8/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.baeldung.enums;
-
-
-public enum PizzaDeliverySystemConfiguration {
- INSTANCE;
-
- PizzaDeliverySystemConfiguration() {
- // Do the configuration initialization which
- // involves overriding defaults like delivery strategy
- }
-
- private PizzaDeliveryStrategy deliveryStrategy = PizzaDeliveryStrategy.NORMAL;
-
- public static PizzaDeliverySystemConfiguration getInstance() {
- return INSTANCE;
- }
-
- public PizzaDeliveryStrategy getDeliveryStrategy() {
- return deliveryStrategy;
- }
-
-}
diff --git a/core-java-8/src/main/resources/compressed.zip b/core-java-8/src/main/resources/compressed.zip
deleted file mode 100644
index 03f840ae2b..0000000000
Binary files a/core-java-8/src/main/resources/compressed.zip and /dev/null differ
diff --git a/core-java-8/src/main/resources/fileTest.txt b/core-java-8/src/main/resources/fileTest.txt
deleted file mode 100644
index ce4bea208b..0000000000
--- a/core-java-8/src/main/resources/fileTest.txt
+++ /dev/null
@@ -1 +0,0 @@
-Hello World from fileTest.txt!!!
\ No newline at end of file
diff --git a/core-java-8/src/main/resources/logback.xml b/core-java-8/src/main/resources/logback.xml
deleted file mode 100644
index eefdc7a337..0000000000
--- a/core-java-8/src/main/resources/logback.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
- web - %date [%thread] %-5level %logger{36} - %message%n
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core-java-8/src/main/resources/unzipTest/test1.txt b/core-java-8/src/main/resources/unzipTest/test1.txt
deleted file mode 100644
index c57eff55eb..0000000000
--- a/core-java-8/src/main/resources/unzipTest/test1.txt
+++ /dev/null
@@ -1 +0,0 @@
-Hello World!
\ No newline at end of file
diff --git a/core-java-8/src/main/resources/zipTest/test1.txt b/core-java-8/src/main/resources/zipTest/test1.txt
deleted file mode 100644
index c57eff55eb..0000000000
--- a/core-java-8/src/main/resources/zipTest/test1.txt
+++ /dev/null
@@ -1 +0,0 @@
-Hello World!
\ No newline at end of file
diff --git a/core-java-8/src/main/resources/zipTest/test2.txt b/core-java-8/src/main/resources/zipTest/test2.txt
deleted file mode 100644
index f0fb0f14d1..0000000000
--- a/core-java-8/src/main/resources/zipTest/test2.txt
+++ /dev/null
@@ -1 +0,0 @@
-My Name is John
\ No newline at end of file
diff --git a/core-java-8/src/main/resources/zipTest/testFolder/test3.txt b/core-java-8/src/main/resources/zipTest/testFolder/test3.txt
deleted file mode 100644
index 882edb168e..0000000000
--- a/core-java-8/src/main/resources/zipTest/testFolder/test3.txt
+++ /dev/null
@@ -1 +0,0 @@
-My Name is Tom
\ No newline at end of file
diff --git a/core-java-8/src/main/resources/zipTest/testFolder/test4.txt b/core-java-8/src/main/resources/zipTest/testFolder/test4.txt
deleted file mode 100644
index a78c3fadc8..0000000000
--- a/core-java-8/src/main/resources/zipTest/testFolder/test4.txt
+++ /dev/null
@@ -1 +0,0 @@
-My Name is Jane
\ No newline at end of file
diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTest.java
deleted file mode 100644
index 8af33393be..0000000000
--- a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.baeldung.datetime;
-
-import java.time.DayOfWeek;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.Month;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class UseLocalDateTest {
-
- UseLocalDate useLocalDate = new UseLocalDate();
-
- @Test
- public void givenValues_whenUsingFactoryOf_thenLocalDate(){
- Assert.assertEquals("2016-05-10",useLocalDate.getLocalDateUsingFactoryOfMethod(2016,5,10).toString());
- }
-
- @Test
- public void givenString_whenUsingParse_thenLocalDate(){
- Assert.assertEquals("2016-05-10",useLocalDate.getLocalDateUsingParseMethod("2016-05-10").toString());
- }
-
- @Test
- public void whenUsingClock_thenLocalDate(){
- Assert.assertEquals(LocalDate.now(),useLocalDate.getLocalDateFromClock());
- }
-
- @Test
- public void givenDate_whenUsingPlus_thenNextDay(){
- Assert.assertEquals(LocalDate.now().plusDays(1),useLocalDate.getNextDay(LocalDate.now()));
- }
-
- @Test
- public void givenDate_whenUsingMinus_thenPreviousDay(){
- Assert.assertEquals(LocalDate.now().minusDays(1),useLocalDate.getPreviousDay(LocalDate.now()));
- }
-
- @Test
- public void givenToday_whenUsingGetDayOfWeek_thenDayOfWeek(){
- Assert.assertEquals(DayOfWeek.SUNDAY,useLocalDate.getDayOfWeek(LocalDate.parse("2016-05-22")));
- }
-
- @Test
- public void givenToday_whenUsingWithTemporalAdjuster_thenFirstDayOfMonth(){
- Assert.assertEquals(1,useLocalDate.getFirstDayOfMonth().getDayOfMonth());
- }
-
- @Test
- public void givenLocalDate_whenUsingAtStartOfDay_thenReturnMidnight(){
- Assert.assertEquals(LocalDateTime.parse("2016-05-22T00:00:00"),useLocalDate.getStartOfDay(LocalDate.parse("2016-05-22")));
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeTest.java
deleted file mode 100644
index 69a289fd02..0000000000
--- a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalDateTimeTest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.baeldung.datetime;
-
-import java.time.LocalDate;
-import java.time.LocalTime;
-import java.time.Month;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class UseLocalDateTimeTest {
-
- UseLocalDateTime useLocalDateTime = new UseLocalDateTime();
-
- @Test
- public void givenString_whenUsingParse_thenLocalDateTime(){
- Assert.assertEquals(LocalDate.of(2016, Month.MAY, 10),useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30").toLocalDate());
- Assert.assertEquals(LocalTime.of(6,30),useLocalDateTime.getLocalDateTimeUsingParseMethod("2016-05-10T06:30").toLocalTime());
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeTest.java
deleted file mode 100644
index 7776fad363..0000000000
--- a/core-java-8/src/test/java/com/baeldung/datetime/UseLocalTimeTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.baeldung.datetime;
-
-import java.time.LocalTime;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class UseLocalTimeTest {
-
- UseLocalTime useLocalTime = new UseLocalTime();
-
- @Test
- public void givenValues_whenUsingFactoryOf_thenLocalTime(){
- Assert.assertEquals("07:07:07",useLocalTime.getLocalTimeUsingFactoryOfMethod(7,7,7).toString());
- }
-
- @Test
- public void givenString_whenUsingParse_thenLocalTime(){
- Assert.assertEquals("06:30",useLocalTime.getLocalTimeUsingParseMethod("06:30").toString());
- }
-
- @Test
- public void givenTime_whenAddHour_thenLocalTime(){
- Assert.assertEquals("07:30",useLocalTime.addAnHour(LocalTime.of(6,30)).toString());
- }
-
- @Test
- public void getHourFromLocalTime(){
- Assert.assertEquals(1, useLocalTime.getHourFromLocalTime(LocalTime.of(1,1)));
- }
-
- @Test
- public void getLocalTimeWithMinuteSetToValue(){
- Assert.assertEquals(LocalTime.of(10, 20), useLocalTime.getLocalTimeWithMinuteSetToValue(LocalTime.of(10,10), 20));
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UsePeriodTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UsePeriodTest.java
deleted file mode 100644
index 8a3228aaa5..0000000000
--- a/core-java-8/src/test/java/com/baeldung/datetime/UsePeriodTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.baeldung.datetime;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.Period;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class UsePeriodTest {
- UsePeriod usingPeriod=new UsePeriod();
-
- @Test
- public void givenPeriodAndLocalDate_thenCalculateModifiedDate(){
- Period period = Period.ofDays(1);
- LocalDate localDate = LocalDate.parse("2007-05-10");
- Assert.assertEquals(localDate.plusDays(1),usingPeriod.modifyDates(localDate, period));
- }
-
- @Test
- public void givenDates_thenGetPeriod(){
- LocalDate localDate1 = LocalDate.parse("2007-05-10");
- LocalDate localDate2 = LocalDate.parse("2007-05-15");
-
- Assert.assertEquals(Period.ofDays(5), usingPeriod.getDifferenceBetweenDates(localDate1, localDate2));
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeTest.java b/core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeTest.java
deleted file mode 100644
index 5af01ad678..0000000000
--- a/core-java-8/src/test/java/com/baeldung/datetime/UseZonedDateTimeTest.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.baeldung.datetime;
-
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class UseZonedDateTimeTest {
-
- UseZonedDateTime zonedDateTime=new UseZonedDateTime();
-
- @Test
- public void givenZoneId_thenZonedDateTime(){
- ZoneId zoneId=ZoneId.of("Europe/Paris");
- ZonedDateTime zonedDatetime=zonedDateTime.getZonedDateTime(LocalDateTime.parse("2016-05-20T06:30"), zoneId);
- Assert.assertEquals(zoneId,ZoneId.from(zonedDatetime));
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/doublecolon/TestComputerUtils.java b/core-java-8/src/test/java/com/baeldung/doublecolon/TestComputerUtils.java
deleted file mode 100644
index 85194f5aa6..0000000000
--- a/core-java-8/src/test/java/com/baeldung/doublecolon/TestComputerUtils.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.baeldung.doublecolon;
-
-import com.baeldung.doublecolon.function.TriFunction;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.function.BiFunction;
-
-import static com.baeldung.doublecolon.ComputerUtils.*;
-
-public class TestComputerUtils {
-
- @Before
- public void setup() {
- }
-
- @After
- public void tearDown() {
- }
-
- @Test
- public void testConstructorReference() {
-
- Computer c1 = new Computer(2015, "white");
- Computer c2 = new Computer(2009, "black");
- Computer c3 = new Computer(2014, "black");
-
- BiFunction c4Function = Computer::new;
- Computer c4 = c4Function.apply(2013, "white");
- BiFunction c5Function = Computer::new;
- Computer c5 = c5Function.apply(2010, "black");
- BiFunction c6Function = Computer::new;
- Computer c6 = c6Function.apply(2008, "black");
-
- List inventory = Arrays.asList(c1, c2, c3, c4, c5, c6);
-
- List blackComputer = filter(inventory, blackPredicate);
- Assert.assertEquals("The black Computers are: ", blackComputer.size(), 4);
-
- List after2010Computer = filter(inventory, after2010Predicate);
- Assert.assertEquals("The Computer bought after 2010 are: ", after2010Computer.size(), 3);
-
- List before2011Computer = filter(inventory, c -> c.getAge() < 2011);
- Assert.assertEquals("The Computer bought before 2011 are: ", before2011Computer.size(), 3);
-
- inventory.sort(Comparator.comparing(Computer::getAge));
-
- Assert.assertEquals("Oldest Computer in inventory", c6, inventory.get(0));
-
- }
-
- @Test
- public void testStaticMethodReference() {
-
- Computer c1 = new Computer(2015, "white", 35);
- Computer c2 = new Computer(2009, "black", 65);
- TriFunction c6Function = Computer::new;
- Computer c3 = c6Function.apply(2008, "black", 90);
-
- List inventory = Arrays.asList(c1, c2, c3);
- inventory.forEach(ComputerUtils::repair);
-
- Assert.assertEquals("Computer repaired", new Integer(100), c1.getHealty());
- }
-
- @Test
- public void testInstanceMethodArbitraryObjectParticularType() {
-
- Computer c1 = new Computer(2015, "white", 35);
- Computer c2 = new MacbookPro(2009, "black", 65);
- List inventory = Arrays.asList(c1, c2);
- inventory.forEach(Computer::turnOnPc);
-
- }
-
- @Test
- public void testSuperMethodReference() {
-
- final TriFunction integerStringIntegerObjectTriFunction = MacbookPro::new;
- final MacbookPro macbookPro = integerStringIntegerObjectTriFunction.apply(2010, "black", 100);
- Double initialValue = new Double(999.99);
- final Double actualValue = macbookPro.calculateValue(initialValue);
- Assert.assertEquals(766.659, actualValue, 0.0);
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/encoderdecoder/EncoderDecoder.java b/core-java-8/src/test/java/com/baeldung/encoderdecoder/EncoderDecoder.java
deleted file mode 100644
index 208a23eb91..0000000000
--- a/core-java-8/src/test/java/com/baeldung/encoderdecoder/EncoderDecoder.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.baeldung.encoderdecoder;
-
-import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-public class EncoderDecoder {
-
- private static final String URL = "http://www.baeldung.com?key1=value+1&key2=value%40%21%242&key3=value%253";
- private static final Logger LOGGER = LoggerFactory.getLogger(EncoderDecoder.class);
-
- private String encodeValue(String value) {
- String encoded = null;
- try {
- encoded = URLEncoder.encode(value, StandardCharsets.UTF_8.toString());
- } catch (UnsupportedEncodingException e) {
- LOGGER.error("Error encoding parameter {}", e.getMessage(), e);
- }
- return encoded;
- }
-
-
- private String decode(String value) {
- String decoded = null;
- try {
- decoded = URLDecoder.decode(value, StandardCharsets.UTF_8.toString());
- } catch (UnsupportedEncodingException e) {
- LOGGER.error("Error encoding parameter {}", e.getMessage(), e);
- }
- return decoded;
- }
-
- @Test
- public void givenURL_whenAnalyze_thenCorrect() throws Exception {
- URL url = new URL(URL);
-
- Assert.assertThat(url.getProtocol(), CoreMatchers.is("http"));
- Assert.assertThat(url.getHost(), CoreMatchers.is("www.baeldung.com"));
- Assert.assertThat(url.getQuery(), CoreMatchers.is("key1=value+1&key2=value%40%21%242&key3=value%253"));
- }
-
- @Test
- public void givenRequestParam_whenUTF8Scheme_thenEncode() throws Exception {
- Map requestParams = new HashMap<>();
- requestParams.put("key1", "value 1");
- requestParams.put("key2", "value@!$2");
- requestParams.put("key3", "value%3");
-
- String encodedQuery = requestParams.keySet().stream()
- .map(key -> key + "=" + encodeValue(requestParams.get(key)))
- .collect(Collectors.joining("&"));
- String encodedURL = "http://www.baeldung.com?" + encodedQuery;
-
- Assert.assertThat(URL, CoreMatchers.is(encodedURL));
- }
-
- @Test
- public void givenRequestParam_whenUTF8Scheme_thenDecodeRequestParams() throws Exception {
- URL url = new URL(URL);
- String query = url.getQuery();
-
- String decodedQuery = Arrays.stream(query.split("&"))
- .map(param -> param.split("=")[0] + "=" + decode(param.split("=")[1]))
- .collect(Collectors.joining("&"));
-
- Assert.assertEquals(
- "http://www.baeldung.com?key1=value 1&key2=value@!$2&key3=value%3", url.getProtocol() + "://" + url.getHost() + "?" + decodedQuery);
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/enums/PizzaTest.java b/core-java-8/src/test/java/com/baeldung/enums/PizzaTest.java
deleted file mode 100644
index deeebaa240..0000000000
--- a/core-java-8/src/test/java/com/baeldung/enums/PizzaTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.baeldung.enums;
-
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.EnumMap;
-import java.util.List;
-
-import static junit.framework.TestCase.assertTrue;
-
-public class PizzaTest {
-
- @Test
- public void givenPizaOrder_whenReady_thenDeliverable() {
- Pizza testPz = new Pizza();
- testPz.setStatus(Pizza.PizzaStatusEnum.READY);
- assertTrue(testPz.isDeliverable());
- }
-
- @Test
- public void givenPizaOrders_whenRetrievingUnDeliveredPzs_thenCorrectlyRetrieved() {
- List pzList = new ArrayList<>();
- Pizza pz1 = new Pizza();
- pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED);
-
- Pizza pz2 = new Pizza();
- pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED);
-
- Pizza pz3 = new Pizza();
- pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED);
-
- Pizza pz4 = new Pizza();
- pz4.setStatus(Pizza.PizzaStatusEnum.READY);
-
- pzList.add(pz1);
- pzList.add(pz2);
- pzList.add(pz3);
- pzList.add(pz4);
-
- List undeliveredPzs = Pizza.getAllUndeliveredPizzas(pzList);
- assertTrue(undeliveredPzs.size() == 3);
- }
-
- @Test
- public void givenPizaOrders_whenGroupByStatusCalled_thenCorrectlyGrouped() {
-
- List pzList = new ArrayList<>();
- Pizza pz1 = new Pizza();
- pz1.setStatus(Pizza.PizzaStatusEnum.DELIVERED);
-
- Pizza pz2 = new Pizza();
- pz2.setStatus(Pizza.PizzaStatusEnum.ORDERED);
-
- Pizza pz3 = new Pizza();
- pz3.setStatus(Pizza.PizzaStatusEnum.ORDERED);
-
- Pizza pz4 = new Pizza();
- pz4.setStatus(Pizza.PizzaStatusEnum.READY);
-
- pzList.add(pz1);
- pzList.add(pz2);
- pzList.add(pz3);
- pzList.add(pz4);
-
- EnumMap> map = Pizza.groupPizzaByStatus(pzList);
- assertTrue(map.get(Pizza.PizzaStatusEnum.DELIVERED).size() == 1);
- assertTrue(map.get(Pizza.PizzaStatusEnum.ORDERED).size() == 2);
- assertTrue(map.get(Pizza.PizzaStatusEnum.READY).size() == 1);
- }
-
- @Test
- public void givenPizaOrder_whenDelivered_thenPizzaGetsDeliveredAndStatusChanges() {
- Pizza pz = new Pizza();
- pz.setStatus(Pizza.PizzaStatusEnum.READY);
- pz.deliver();
- assertTrue(pz.getStatus() == Pizza.PizzaStatusEnum.DELIVERED);
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java b/core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java
deleted file mode 100644
index e21af9552a..0000000000
--- a/core-java-8/src/test/java/com/baeldung/file/FileOperationsTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.baeldung.file;
-
-import org.apache.commons.io.FileUtils;
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.Matchers;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.stream.Stream;
-
-public class FileOperationsTest {
-
- @Test
- public void givenFileName_whenUsingClassloader_thenFileData() throws IOException {
- String expectedData = "Hello World from fileTest.txt!!!";
-
- ClassLoader classLoader = getClass().getClassLoader();
- File file = new File(classLoader.getResource("fileTest.txt").getFile());
- InputStream inputStream = new FileInputStream(file);
- String data = readFromInputStream(inputStream);
-
- Assert.assertEquals(expectedData, data.trim());
- }
-
- @Test
- public void givenFileNameAsAbsolutePath_whenUsingClasspath_thenFileData() throws IOException {
- String expectedData = "Hello World from fileTest.txt!!!";
-
- Class clazz = FileOperationsTest.class;
- InputStream inputStream = clazz.getResourceAsStream("/fileTest.txt");
- String data = readFromInputStream(inputStream);
-
- Assert.assertEquals(expectedData, data.trim());
- }
-
- @Test
- public void givenFileName_whenUsingJarFile_thenFileData() throws IOException {
- String expectedData = "BSD License";
-
- Class clazz = Matchers.class;
- InputStream inputStream = clazz.getResourceAsStream("/LICENSE.txt");
- String data = readFromInputStream(inputStream);
-
- Assert.assertThat(data.trim(), CoreMatchers.containsString(expectedData));
- }
-
- @Test
- public void givenURLName_whenUsingURL_thenFileData() throws IOException {
- String expectedData = "Baeldung";
-
- URL urlObject = new URL("http://www.baeldung.com/");
-
- URLConnection urlConnection = urlObject.openConnection();
-
- InputStream inputStream = urlConnection.getInputStream();
- String data = readFromInputStream(inputStream);
-
- Assert.assertThat(data.trim(), CoreMatchers.containsString(expectedData));
- }
-
- @Test
- public void givenFileName_whenUsingFileUtils_thenFileData() throws IOException {
- String expectedData = "Hello World from fileTest.txt!!!";
-
- ClassLoader classLoader = getClass().getClassLoader();
- File file = new File(classLoader.getResource("fileTest.txt").getFile());
- String data = FileUtils.readFileToString(file);
-
- Assert.assertEquals(expectedData, data.trim());
- }
-
- @Test
- public void givenFilePath_whenUsingFilesReadAllBytes_thenFileData() throws IOException, URISyntaxException {
- String expectedData = "Hello World from fileTest.txt!!!";
-
- Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI());
-
- byte[] fileBytes = Files.readAllBytes(path);
- String data = new String(fileBytes);
-
- Assert.assertEquals(expectedData, data.trim());
- }
-
- @Test
- public void givenFilePath_whenUsingFilesLines_thenFileData() throws IOException, URISyntaxException {
- String expectedData = "Hello World from fileTest.txt!!!";
-
- Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI());
-
- StringBuilder data = new StringBuilder();
- Stream lines = Files.lines(path);
- lines.forEach(line -> data.append(line).append("\n"));
- lines.close();
-
- Assert.assertEquals(expectedData, data.toString().trim());
- }
-
- private String readFromInputStream(InputStream inputStream) throws IOException {
- StringBuilder resultStringBuilder = new StringBuilder();
- try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream))) {
- String line;
- while ((line = bufferedReader.readLine()) != null) {
- resultStringBuilder.append(line).append("\n");
- }
- }
-
- return resultStringBuilder.toString();
- }
-}
\ No newline at end of file
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java
deleted file mode 100644
index ef4b80c6e8..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8CollectionCleanupUnitTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.baeldung.java8;
-
-import com.google.common.collect.Lists;
-import org.junit.Test;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-import static org.hamcrest.Matchers.hasSize;
-import static org.junit.Assert.assertThat;
-
-public class Java8CollectionCleanupUnitTest {
-
- // tests -
-
- @Test
- public void givenListContainsNulls_whenFilteringParallel_thenCorrect() {
- final List list = Lists.newArrayList(null, 1, 2, null, 3, null);
- final List listWithoutNulls = list.parallelStream().filter(i -> i != null).collect(Collectors.toList());
-
- assertThat(listWithoutNulls, hasSize(3));
- }
-
- @Test
- public void givenListContainsNulls_whenFilteringSerial_thenCorrect() {
- final List list = Lists.newArrayList(null, 1, 2, null, 3, null);
- final List listWithoutNulls = list.stream().filter(i -> i != null).collect(Collectors.toList());
-
- assertThat(listWithoutNulls, hasSize(3));
- }
-
- @Test
- public void givenListContainsNulls_whenRemovingNullsWithRemoveIf_thenCorrect() {
- final List listWithoutNulls = Lists.newArrayList(null, 1, 2, null, 3, null);
- listWithoutNulls.removeIf(p -> p == null);
-
- assertThat(listWithoutNulls, hasSize(3));
- }
-
- @Test
- public void givenListContainsDuplicates_whenRemovingDuplicatesWithJava8_thenCorrect() {
- final List listWithDuplicates = Lists.newArrayList(1, 1, 2, 2, 3, 3);
- final List listWithoutDuplicates = listWithDuplicates.parallelStream().distinct().collect(Collectors.toList());
-
- assertThat(listWithoutDuplicates, hasSize(3));
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsTest.java
deleted file mode 100644
index 21a5e34b9b..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8DefaultStaticIntefaceMethodsTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.baeldung.java8;
-
-import com.baeldung.java_8_features.Vehicle;
-import com.baeldung.java_8_features.VehicleImpl;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class Java8DefaultStaticIntefaceMethodsTest {
-
- @Test
- public void callStaticInterfaceMethdosMethods_whenExpectedResults_thenCorrect() {
- Vehicle vehicle = new VehicleImpl();
- String overview = vehicle.getOverview();
- long[] startPosition = vehicle.startPosition();
-
- assertEquals(overview, "ATV made by N&F Vehicles");
- assertEquals(startPosition[0], 23);
- assertEquals(startPosition[1], 15);
- }
-
- @Test
- public void callDefaultInterfaceMethods_whenExpectedResults_thenCorrect() {
- String producer = Vehicle.producer();
- assertEquals(producer, "N&F Vehicles");
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java
deleted file mode 100644
index 581ccec182..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8ExecutorServiceTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.baeldung.java8;
-
-
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.*;
-
-import static org.junit.Assert.*;
-
-
-public class Java8ExecutorServiceTest {
-
- private Runnable runnableTask;
- private Callable callableTask;
- private List> callableTasks;
-
- @Before
- public void init() {
-
- runnableTask = () -> {
- try {
- TimeUnit.MILLISECONDS.sleep(300);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- };
-
- callableTask = () -> {
- TimeUnit.MILLISECONDS.sleep(300);
- return "Task's execution";
- };
-
- callableTasks = new ArrayList<>();
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
- callableTasks.add(callableTask);
- }
-
- @Test
- public void creationSubmittingTaskShuttingDown_whenShutDown_thenCorrect() {
-
- ExecutorService executorService = Executors.newFixedThreadPool(10);
- executorService.submit(runnableTask);
- executorService.submit(callableTask);
- executorService.shutdown();
-
- assertTrue(executorService.isShutdown());
- }
-
- @Test
- public void creationSubmittingTasksShuttingDownNow_whenShutDownAfterAwating_thenCorrect() {
-
- ExecutorService threadPoolExecutor =
- new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS,
- new LinkedBlockingQueue<>());
-
- for (int i = 0; i < 100; i++) {
- threadPoolExecutor.submit(callableTask);
- }
-
- List notExecutedTasks = smartShutdown(threadPoolExecutor);
-
- assertTrue(threadPoolExecutor.isShutdown());
- assertFalse(notExecutedTasks.isEmpty());
- assertTrue(notExecutedTasks.size() > 0 && notExecutedTasks.size() < 98);
- }
-
- private List smartShutdown(ExecutorService executorService) {
-
- List notExecutedTasks = new ArrayList<>();
- executorService.shutdown();
- try {
- if (!executorService.awaitTermination(800, TimeUnit.MILLISECONDS)) {
- notExecutedTasks = executorService.shutdownNow();
- }
- } catch (InterruptedException e) {
- notExecutedTasks = executorService.shutdownNow();
- }
- return notExecutedTasks;
- }
-
- @Test
- public void submittingTasks_whenExecutedOneAndAll_thenCorrect() {
-
- ExecutorService executorService = Executors.newFixedThreadPool(10);
-
- String result = null;
- List> futures = new ArrayList<>();
- try {
- result = executorService.invokeAny(callableTasks);
- futures = executorService.invokeAll(callableTasks);
- } catch (InterruptedException | ExecutionException e) {
- e.printStackTrace();
- }
-
- assertEquals("Task's execution", result);
- assertTrue(futures.size() == 3);
- }
-
- @Test
- public void submittingTaskShuttingDown_whenGetExpectedResult_thenCorrect() {
-
- ExecutorService executorService = Executors.newFixedThreadPool(10);
-
- Future future = executorService.submit(callableTask);
- String result = null;
- try {
- result = future.get();
- result = future.get(200, TimeUnit.MILLISECONDS);
- } catch (InterruptedException | ExecutionException | TimeoutException e) {
- e.printStackTrace();
- }
-
- executorService.shutdown();
-
- assertEquals("Task's execution", result);
- }
-
- @Test
- public void submittingTask_whenCanceled_thenCorrect() {
-
- ExecutorService executorService = Executors.newFixedThreadPool(10);
-
- Future future = executorService.submit(callableTask);
-
- boolean canceled = future.cancel(true);
- boolean isCancelled = future.isCancelled();
-
- executorService.shutdown();
-
- assertTrue(canceled);
- assertTrue(isCancelled);
- }
-
- @Test
- public void submittingTaskScheduling_whenExecuted_thenCorrect() {
-
- ScheduledExecutorService executorService = Executors
- .newSingleThreadScheduledExecutor();
-
- Future resultFuture = executorService.schedule(callableTask, 1, TimeUnit.SECONDS);
- String result = null;
- try {
- result = resultFuture.get();
- } catch (InterruptedException | ExecutionException e) {
- e.printStackTrace();
- }
-
- executorService.shutdown();
-
- assertEquals("Task's execution", result);
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8ForkJoinTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8ForkJoinTest.java
deleted file mode 100644
index 273b2d78db..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8ForkJoinTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package com.baeldung.java8;
-
-
-import com.baeldung.forkjoin.CustomRecursiveAction;
-import com.baeldung.forkjoin.CustomRecursiveTask;
-import com.baeldung.forkjoin.util.PoolUtil;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Random;
-import java.util.concurrent.ForkJoinPool;
-
-import static org.junit.Assert.*;
-
-public class Java8ForkJoinTest {
-
- private int[] arr;
- private CustomRecursiveTask customRecursiveTask;
-
- @Before
- public void init() {
- Random random = new Random();
- arr = new int[50];
- for (int i = 0; i < arr.length; i++) {
- arr[i] = random.nextInt(35);
- }
- customRecursiveTask = new CustomRecursiveTask(arr);
- }
-
-
- @Test
- public void callPoolUtil_whenExistsAndExpectedType_thenCorrect() {
-
- ForkJoinPool forkJoinPool = PoolUtil.forkJoinPool;
- ForkJoinPool forkJoinPoolTwo = PoolUtil.forkJoinPool;
-
- assertNotNull(forkJoinPool);
- assertEquals(2, forkJoinPool.getParallelism());
- assertEquals(forkJoinPool, forkJoinPoolTwo);
-
- }
-
- @Test
- public void callCommonPool_whenExistsAndExpectedType_thenCorrect() {
-
- ForkJoinPool commonPool = ForkJoinPool.commonPool();
- ForkJoinPool commonPoolTwo = ForkJoinPool.commonPool();
-
- assertNotNull(commonPool);
- assertEquals(commonPool, commonPoolTwo);
-
- }
-
- @Test
- public void executeRecursiveAction_whenExecuted_thenCorrect() {
-
- CustomRecursiveAction myRecursiveAction = new CustomRecursiveAction("ddddffffgggghhhh");
- ForkJoinPool.commonPool().invoke(myRecursiveAction);
-
- assertTrue(myRecursiveAction.isDone());
-
- }
-
- @Test
- public void executeRecursiveTask_whenExecuted_thenCorrect() {
-
- ForkJoinPool forkJoinPool = ForkJoinPool.commonPool();
-
- forkJoinPool.execute(customRecursiveTask);
- int result = customRecursiveTask.join();
- assertTrue(customRecursiveTask.isDone());
-
- forkJoinPool.submit(customRecursiveTask);
- int resultTwo = customRecursiveTask.join();
- assertTrue(customRecursiveTask.isDone());
-
- }
-
- @Test
- public void executeRecursiveTaskWithFJ_whenExecuted_thenCorrect() {
-
- CustomRecursiveTask customRecursiveTaskFirst = new CustomRecursiveTask(arr);
- CustomRecursiveTask customRecursiveTaskSecond = new CustomRecursiveTask(arr);
- CustomRecursiveTask customRecursiveTaskLast = new CustomRecursiveTask(arr);
-
- customRecursiveTaskFirst.fork();
- customRecursiveTaskSecond.fork();
- customRecursiveTaskLast.fork();
- int result = 0;
- result += customRecursiveTaskLast.join();
- result += customRecursiveTaskSecond.join();
- result += customRecursiveTaskFirst.join();
-
- assertTrue(customRecursiveTaskFirst.isDone());
- assertTrue(customRecursiveTaskSecond.isDone());
- assertTrue(customRecursiveTaskLast.isDone());
- assertTrue(result != 0);
-
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasTest.java
deleted file mode 100644
index faaf3ae407..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8FunctionalInteracesLambdasTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.baeldung.java8;
-
-import com.baeldung.Foo;
-import com.baeldung.FooExtended;
-import com.baeldung.UseFoo;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.function.Function;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-
-public class Java8FunctionalInteracesLambdasTest {
-
- private UseFoo useFoo;
-
- @Before
- public void init() {
- useFoo = new UseFoo();
- }
-
- @Test
- public void functionalInterfaceInstantiation_whenReturnDefiniteString_thenCorrect() {
- final Foo foo = parameter -> parameter + "from lambda";
- final String result = useFoo.add("Message ", foo);
-
- assertEquals("Message from lambda", result);
- }
-
- @Test
- public void standardFIParameter_whenReturnDefiniteString_thenCorrect() {
- final Function fn = parameter -> parameter + "from lambda";
- final String result = useFoo.addWithStandardFI("Message ", fn);
-
- assertEquals("Message from lambda", result);
- }
-
- @Test
- public void defaultMethodFromExtendedInterface_whenReturnDefiniteString_thenCorrect() {
- final FooExtended fooExtended = string -> string;
- final String result = fooExtended.defaultMethod();
-
- assertEquals("String from Bar", result);
- }
-
- @Test
- public void lambdaAndInnerClassInstantiation_whenReturnSameString_thenCorrect() {
- final Foo foo = parameter -> parameter + "from Foo";
-
- final Foo fooByIC = new Foo() {
- @Override
- public String method(final String string) {
- return string + "from Foo";
- }
- };
-
- assertEquals(foo.method("Something "), fooByIC.method("Something "));
- }
-
- @Test
- public void accessVariablesFromDifferentScopes_whenReturnPredefinedString_thenCorrect() {
- assertEquals("Results: resultIC = Inner class value, resultLambda = Enclosing scope value", useFoo.scopeExperiment());
- }
-
- @Test
- public void shorteningLambdas_whenReturnEqualsResults_thenCorrect() {
- final Foo foo = parameter -> buildString(parameter);
-
- final Foo fooHuge = parameter -> {
- final String result = "Something " + parameter;
- // many lines of code
- return result;
- };
-
- assertEquals(foo.method("Something"), fooHuge.method("Something"));
- }
-
- private String buildString(final String parameter) {
- final String result = "Something " + parameter;
- // many lines of code
- return result;
- }
-
- @Test
- public void mutatingOfEffectivelyFinalVariable_whenNotEquals_thenCorrect() {
- final int[] total = new int[1];
- final Runnable r = () -> total[0]++;
- r.run();
-
- assertNotEquals(0, total[0]);
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceTest.java
deleted file mode 100644
index d9d88c5052..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8MethodReferenceTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.baeldung.java8;
-
-import com.baeldung.java_8_features.User;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class Java8MethodReferenceTest {
-
- private List list;
-
- @Before
- public void init() {
- list = new ArrayList<>();
- list.add("One");
- list.add("OneAndOnly");
- list.add("Derek");
- list.add("Change");
- list.add("factory");
- list.add("justBefore");
- list.add("Italy");
- list.add("Italy");
- list.add("Thursday");
- list.add("");
- list.add("");
- }
-
- @Test
- public void checkStaticMethodReferences_whenWork_thenCorrect() {
-
- List users = new ArrayList<>();
- users.add(new User());
- users.add(new User());
- boolean isReal = users.stream().anyMatch(u -> User.isRealUser(u));
- boolean isRealRef = users.stream().anyMatch(User::isRealUser);
- assertTrue(isReal);
- assertTrue(isRealRef);
- }
-
- @Test
- public void checkInstanceMethodReferences_whenWork_thenCorrect() {
- User user = new User();
- boolean isLegalName = list.stream().anyMatch(user::isLegalName);
- assertTrue(isLegalName);
- }
-
- @Test
- public void checkParticularTypeReferences_whenWork_thenCorrect() {
- long count = list.stream().filter(String::isEmpty).count();
- assertEquals(count, 2);
- }
-
- @Test
- public void checkConstructorReferences_whenWork_thenCorrect() {
- Stream stream = list.stream().map(User::new);
- List userList = stream.collect(Collectors.toList());
- assertEquals(userList.size(), list.size());
- assertTrue(userList.get(0) instanceof User);
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8OptionalTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8OptionalTest.java
deleted file mode 100644
index 26de39bc0e..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8OptionalTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package com.baeldung.java8;
-
-import com.baeldung.java_8_features.*;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-import static org.junit.Assert.*;
-
-public class Java8OptionalTest {
-
- private List list;
-
- @Before
- public void init() {
- list = new ArrayList<>();
- list.add("One");
- list.add("OneAndOnly");
- list.add("Derek");
- list.add("Change");
- list.add("factory");
- list.add("justBefore");
- list.add("Italy");
- list.add("Italy");
- list.add("Thursday");
- list.add("");
- list.add("");
- }
-
- @Test
- public void checkOptional_whenAsExpected_thenCorrect() {
-
- Optional optionalEmpty = Optional.empty();
- assertFalse(optionalEmpty.isPresent());
-
- String str = "value";
- Optional optional = Optional.of(str);
- assertEquals(optional.get(), "value");
-
- Optional optionalNullable = Optional.ofNullable(str);
- Optional optionalNull = Optional.ofNullable(null);
- assertEquals(optionalNullable.get(), "value");
- assertFalse(optionalNull.isPresent());
-
- List listOpt = Optional.of(list).orElse(new ArrayList<>());
- List listNull = null;
- List listOptNull = Optional.ofNullable(listNull).orElse(new ArrayList<>());
- assertTrue(listOpt == list);
- assertTrue(listOptNull.isEmpty());
-
- Optional user = Optional.ofNullable(getUser());
- String result = user.map(User::getAddress)
- .map(Address::getStreet)
- .orElse("not specified");
- assertEquals(result, "1st Avenue");
-
- Optional optionalUser = Optional.ofNullable(getOptionalUser());
- String resultOpt = optionalUser.flatMap(OptionalUser::getAddress)
- .flatMap(OptionalAddress::getStreet)
- .orElse("not specified");
- assertEquals(resultOpt, "1st Avenue");
-
- Optional userNull = Optional.ofNullable(getUserNull());
- String resultNull = userNull.map(User::getAddress)
- .map(Address::getStreet)
- .orElse("not specified");
- assertEquals(resultNull, "not specified");
-
- Optional optionalUserNull = Optional.ofNullable(getOptionalUserNull());
- String resultOptNull = optionalUserNull.flatMap(OptionalUser::getAddress)
- .flatMap(OptionalAddress::getStreet)
- .orElse("not specified");
- assertEquals(resultOptNull, "not specified");
-
- }
-
- @Test(expected = CustomException.class)
- public void callMethod_whenCustomException_thenCorrect() {
- User user = new User();
- String result = user.getOrThrow();
- }
-
- private User getUser() {
- User user = new User();
- Address address = new Address();
- address.setStreet("1st Avenue");
- user.setAddress(address);
- return user;
- }
-
- private OptionalUser getOptionalUser() {
- OptionalUser user = new OptionalUser();
- OptionalAddress address = new OptionalAddress();
- address.setStreet("1st Avenue");
- user.setAddress(address);
- return user;
- }
-
- private OptionalUser getOptionalUserNull() {
- OptionalUser user = new OptionalUser();
- OptionalAddress address = new OptionalAddress();
- address.setStreet(null);
- user.setAddress(address);
- return user;
- }
-
- private User getUserNull() {
- User user = new User();
- Address address = new Address();
- address.setStreet(null);
- user.setAddress(address);
- return user;
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java
deleted file mode 100644
index f371c0d7da..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8SortUnitTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package com.baeldung.java8;
-
-import com.baeldung.java8.entity.Human;
-import com.google.common.collect.Lists;
-import com.google.common.primitives.Ints;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import static org.hamcrest.Matchers.equalTo;
-
-public class Java8SortUnitTest {
-
- // tests -
-
- @Test
- public final void givenPreLambda_whenSortingEntitiesByName_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
-
- Collections.sort(humans, new Comparator() {
- @Override
- public final int compare(final Human h1, final Human h2) {
- return h1.getName().compareTo(h2.getName());
- }
- });
-
- Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
- }
-
- @Test
- public final void whenSortingEntitiesByName_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
-
- humans.sort((final Human h1, final Human h2) -> h1.getName().compareTo(h2.getName()));
-
- Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
- }
-
- @Test
- public final void givenLambdaShortForm_whenSortingEntitiesByName_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
-
- humans.sort((h1, h2) -> h1.getName().compareTo(h2.getName()));
-
- Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
- }
-
- @Test
- public final void whenSortingEntitiesByNameThenAge_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 12), new Human("Sarah", 10), new Human("Zack", 12));
- humans.sort((lhs, rhs) -> {
- if (lhs.getName().equals(rhs.getName())) {
- return lhs.getAge() - rhs.getAge();
- } else {
- return lhs.getName().compareTo(rhs.getName());
- }
- });
- Assert.assertThat(humans.get(0), equalTo(new Human("Sarah", 10)));
- }
-
- @Test
- public final void givenCompositionVerbose_whenSortingEntitiesByNameThenAge_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 12), new Human("Sarah", 10), new Human("Zack", 12));
- final Comparator byName = (h1, h2) -> h1.getName().compareTo(h2.getName());
- final Comparator byAge = (h1, h2) -> Ints.compare(h1.getAge(), h2.getAge());
-
- humans.sort(byName.thenComparing(byAge));
- Assert.assertThat(humans.get(0), equalTo(new Human("Sarah", 10)));
- }
-
- @Test
- public final void givenComposition_whenSortingEntitiesByNameThenAge_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 12), new Human("Sarah", 10), new Human("Zack", 12));
-
- humans.sort(Comparator.comparing(Human::getName).thenComparing(Human::getAge));
- Assert.assertThat(humans.get(0), equalTo(new Human("Sarah", 10)));
- }
-
- @Test
- public final void whenSortingEntitiesByAge_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
-
- humans.sort((h1, h2) -> Ints.compare(h1.getAge(), h2.getAge()));
- Assert.assertThat(humans.get(0), equalTo(new Human("Sarah", 10)));
- }
-
- @Test
- public final void whenSortingEntitiesByNameReversed_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
- final Comparator comparator = (h1, h2) -> h1.getName().compareTo(h2.getName());
-
- humans.sort(comparator.reversed());
- Assert.assertThat(humans.get(0), equalTo(new Human("Sarah", 10)));
- }
-
- @Test
- public final void givenMethodDefinition_whenSortingEntitiesByNameThenAge_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
-
- humans.sort(Human::compareByNameThenAge);
- Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
- }
-
- @Test
- public final void givenInstanceMethod_whenSortingEntitiesByName_thenCorrectlySorted() {
- final List humans = Lists.newArrayList(new Human("Sarah", 10), new Human("Jack", 12));
-
- humans.sort(Comparator.comparing(Human::getName));
- Assert.assertThat(humans.get(0), equalTo(new Human("Jack", 12)));
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiTest.java
deleted file mode 100644
index 37326c6d26..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamApiTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-package com.baeldung.java8;
-
-import com.baeldung.streamApi.Product;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.*;
-import java.util.regex.Pattern;
-import java.util.stream.*;
-
-import static org.junit.Assert.*;
-
-public class Java8StreamApiTest {
-
- private long counter;
-
- private static Logger log = LoggerFactory.getLogger(Java8StreamApiTest.class);
-
- private List productList;
-
- @Before
- public void init() {
- productList = Arrays.asList(
- new Product(23, "potatoes"), new Product(14, "orange"),
- new Product(13, "lemon"), new Product(23, "bread"),
- new Product(13, "sugar"));
- }
-
- @Test
- public void checkPipeline_whenStreamOneElementShorter_thenCorrect() {
-
- List list = Arrays.asList("abc1", "abc2", "abc3");
- long size = list.stream().skip(1)
- .map(element -> element.substring(0, 3)).count();
- assertEquals(list.size() - 1, size);
- }
-
- @Test
- public void checkOrder_whenChangeQuantityOfMethodCalls_thenCorrect() {
-
- List list = Arrays.asList("abc1", "abc2", "abc3");
-
- counter = 0;
- long sizeFirst = list.stream()
- .skip(2).map(element -> {
- wasCalled();
- return element.substring(0, 3);
- }).count();
- assertEquals(1, counter);
-
- counter = 0;
- long sizeSecond = list.stream().map(element -> {
- wasCalled();
- return element.substring(0, 3);
- }).skip(2).count();
- assertEquals(3, counter);
- }
-
- @Test
- public void createEmptyStream_whenEmpty_thenCorrect() {
-
- Stream streamEmpty = Stream.empty();
- assertEquals(0, streamEmpty.count());
-
- List names = Collections.emptyList();
- Stream streamOf = Product.streamOf(names);
- assertTrue(streamOf.count() == 0);
- }
-
- @Test
- public void createStream_whenCreated_thenCorrect() {
-
- Collection collection = Arrays.asList("a", "b", "c");
- Stream streamOfCollection = collection.stream();
- assertEquals(3, streamOfCollection.count());
-
- Stream streamOfArray = Stream.of("a", "b", "c");
- assertEquals(3, streamOfArray.count());
-
- String[] arr = new String[]{"a", "b", "c"};
- Stream streamOfArrayPart = Arrays.stream(arr, 1, 3);
- assertEquals(2, streamOfArrayPart.count());
-
- IntStream intStream = IntStream.range(1, 3);
- LongStream longStream = LongStream.rangeClosed(1, 3);
- Random random = new Random();
- DoubleStream doubleStream = random.doubles(3);
- assertEquals(2, intStream.count());
- assertEquals(3, longStream.count());
- assertEquals(3, doubleStream.count());
-
- IntStream streamOfChars = "abc".chars();
- IntStream str = "".chars();
- assertEquals(3, streamOfChars.count());
-
- Stream streamOfString = Pattern.compile(", ").splitAsStream("a, b, c");
- assertEquals("a", streamOfString.findFirst().get());
-
- Path path = getPath();
- Stream streamOfStrings = null;
- try {
- streamOfStrings = Files.lines(path, Charset.forName("UTF-8"));
- } catch (IOException e) {
- log.error("Error creating streams from paths {}", path, e.getMessage(), e);
- }
- assertEquals("a", streamOfStrings.findFirst().get());
-
- Stream streamBuilder = Stream.builder().add("a").add("b").add("c").build();
- assertEquals(3, streamBuilder.count());
-
- Stream streamGenerated = Stream.generate(() -> "element").limit(10);
- assertEquals(10, streamGenerated.count());
-
- Stream streamIterated = Stream.iterate(40, n -> n + 2).limit(20);
- assertTrue(40 <= streamIterated.findAny().get());
- }
-
- @Test
- public void runStreamPipeline_whenOrderIsRight_thenCorrect() {
-
- List list = Arrays.asList("abc1", "abc2", "abc3");
- Optional stream = list.stream()
- .filter(element -> {
- log.info("filter() was called");
- return element.contains("2");
- }).map(element -> {
- log.info("map() was called");
- return element.toUpperCase();
- }).findFirst();
- }
-
- @Test
- public void reduce_whenExpected_thenCorrect() {
-
- OptionalInt reduced = IntStream.range(1, 4).reduce((a, b) -> a + b);
- assertEquals(6, reduced.getAsInt());
-
- int reducedTwoParams = IntStream.range(1, 4).reduce(10, (a, b) -> a + b);
- assertEquals(16, reducedTwoParams);
-
- int reducedThreeParams = Stream.of(1, 2, 3)
- .reduce(10, (a, b) -> a + b, (a, b) -> {
- log.info("combiner was called");
- return a + b;
- });
- assertEquals(16, reducedThreeParams);
-
- int reducedThreeParamsParallel = Arrays.asList(1, 2, 3).parallelStream()
- .reduce(10, (a, b) -> a + b, (a, b) -> {
- log.info("combiner was called");
- return a + b;
- });
- assertEquals(36, reducedThreeParamsParallel);
- }
-
- @Test
- public void collecting_whenAsExpected_thenCorrect() {
-
- List collectorCollection = productList.stream()
- .map(Product::getName).collect(Collectors.toList());
-
- assertTrue(collectorCollection instanceof List);
- assertEquals(5, collectorCollection.size());
-
- String listToString = productList.stream().map(Product::getName)
- .collect(Collectors.joining(", ", "[", "]"));
-
- assertTrue(listToString.contains(",") && listToString.contains("[") && listToString.contains("]"));
-
- double averagePrice = productList.stream().collect(Collectors.averagingInt(Product::getPrice));
- assertTrue(17.2 == averagePrice);
-
- int summingPrice = productList.stream().collect(Collectors.summingInt(Product::getPrice));
- assertEquals(86, summingPrice);
-
- IntSummaryStatistics statistics = productList.stream()
- .collect(Collectors.summarizingInt(Product::getPrice));
- assertEquals(23, statistics.getMax());
-
- Map> collectorMapOfLists = productList.stream()
- .collect(Collectors.groupingBy(Product::getPrice));
- assertEquals(3, collectorMapOfLists.keySet().size());
-
- Map> mapPartioned = productList.stream()
- .collect(Collectors.partitioningBy(element -> element.getPrice() > 15));
- assertEquals(2, mapPartioned.keySet().size());
-
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void collect_whenThrows_thenCorrect() {
- Set unmodifiableSet = productList.stream()
- .collect(Collectors.collectingAndThen(Collectors.toSet(),
- Collections::unmodifiableSet));
- unmodifiableSet.add(new Product(4, "tea"));
- }
-
- @Test
- public void customCollector_whenResultContainsAllElementsFrSource_thenCorrect() {
- Collector> toLinkedList =
- Collector.of(LinkedList::new, LinkedList::add,
- (first, second) -> {
- first.addAll(second);
- return first;
- });
-
- LinkedList linkedListOfPersons = productList.stream().collect(toLinkedList);
- assertTrue(linkedListOfPersons.containsAll(productList));
- }
-
- @Test
- public void parallelStream_whenWorks_thenCorrect() {
- Stream streamOfCollection = productList.parallelStream();
- boolean isParallel = streamOfCollection.isParallel();
- boolean haveBigPrice = streamOfCollection.map(product -> product.getPrice() * 12)
- .anyMatch(price -> price > 200);
- assertTrue(isParallel && haveBigPrice);
- }
-
- @Test
- public void parallel_whenIsParallel_thenCorrect() {
- IntStream intStreamParallel =
- IntStream.range(1, 150).parallel().map(element -> element * 34);
- boolean isParallel = intStreamParallel.isParallel();
- assertTrue(isParallel);
- }
-
- @Test
- public void parallel_whenIsSequential_thenCorrect() {
- IntStream intStreamParallel =
- IntStream.range(1, 150).parallel().map(element -> element * 34);
- IntStream intStreamSequential = intStreamParallel.sequential();
- boolean isParallel = intStreamParallel.isParallel();
- assertFalse(isParallel);
- }
-
- private Path getPath() {
- Path path = null;
- try {
- path = Files.createTempFile(null, ".txt");
- } catch (IOException e) {
- log.error(e.getMessage());
- }
-
- try (BufferedWriter writer = Files.newBufferedWriter(path)) {
- writer.write("a\nb\nc");
- } catch (IOException e) {
- log.error(e.getMessage());
- }
- return path;
- }
-
- private void wasCalled() {
- counter++;
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamsTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8StreamsTest.java
deleted file mode 100644
index 1f1dda49ce..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/Java8StreamsTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package com.baeldung.java8;
-
-import com.baeldung.java_8_features.Detail;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.junit.Assert.*;
-
-public class Java8StreamsTest {
-
- private List list;
-
- @Before
- public void init() {
- list = new ArrayList<>();
- list.add("One");
- list.add("OneAndOnly");
- list.add("Derek");
- list.add("Change");
- list.add("factory");
- list.add("justBefore");
- list.add("Italy");
- list.add("Italy");
- list.add("Thursday");
- list.add("");
- list.add("");
- }
-
- @Test
- public void checkStreamCount_whenCreating_givenDifferentSources() {
- String[] arr = new String[]{"a", "b", "c"};
- Stream streamArr = Arrays.stream(arr);
- assertEquals(streamArr.count(), 3);
-
- Stream streamOf = Stream.of("a", "b", "c");
- assertEquals(streamOf.count(), 3);
-
- long count = list.stream().distinct().count();
- assertEquals(count, 9);
- }
-
-
- @Test
- public void checkStreamCount_whenOperationFilter_thanCorrect() {
- Stream streamFilter = list.stream().filter(element -> element.isEmpty());
- assertEquals(streamFilter.count(), 2);
- }
-
-
- @Test
- public void checkStreamCount_whenOperationMap_thanCorrect() {
- List uris = new ArrayList<>();
- uris.add("C:\\My.txt");
- Stream streamMap = uris.stream().map(uri -> Paths.get(uri));
- assertEquals(streamMap.count(), 1);
-
- List details = new ArrayList<>();
- details.add(new Detail());
- details.add(new Detail());
- Stream streamFlatMap = details.stream()
- .flatMap(detail -> detail.getParts().stream());
- assertEquals(streamFlatMap.count(), 4);
- }
-
-
- @Test
- public void checkStreamCount_whenOperationMatch_thenCorrect() {
- boolean isValid = list.stream().anyMatch(element -> element.contains("h"));
- boolean isValidOne = list.stream().allMatch(element -> element.contains("h"));
- boolean isValidTwo = list.stream().noneMatch(element -> element.contains("h"));
- assertTrue(isValid);
- assertFalse(isValidOne);
- assertFalse(isValidTwo);
- }
-
-
- @Test
- public void checkStreamReducedValue_whenOperationReduce_thenCorrect() {
- List integers = new ArrayList<>();
- integers.add(1);
- integers.add(1);
- integers.add(1);
- Integer reduced = integers.stream().reduce(23, (a, b) -> a + b);
- assertTrue(reduced == 26);
- }
-
- @Test
- public void checkStreamContains_whenOperationCollect_thenCorrect() {
- List resultList = list.stream()
- .map(element -> element.toUpperCase())
- .collect(Collectors.toList());
- assertEquals(resultList.size(), list.size());
- assertTrue(resultList.contains(""));
- }
-
-
- @Test
- public void checkParallelStream_whenDoWork() {
- list.parallelStream().forEach(element -> doWork(element));
- }
-
- private void doWork(String string) {
- assertTrue(true); //just imitate an amount of work
- }
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/JavaFolderSizeTest.java b/core-java-8/src/test/java/com/baeldung/java8/JavaFolderSizeTest.java
deleted file mode 100644
index f2e7452137..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/JavaFolderSizeTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package com.baeldung.java8;
-
-import org.apache.commons.io.FileUtils;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.*;
-import java.nio.file.attribute.BasicFileAttributes;
-import java.text.DecimalFormat;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.stream.StreamSupport;
-
-import static org.junit.Assert.assertEquals;
-
-public class JavaFolderSizeTest {
-
- private String path;
-
- @Before
- public void init() {
- final String separator = File.separator;
- path = String.format("src%stest%sresources", separator, separator);
- }
-
- @Test
- public void whenGetFolderSizeRecursive_thenCorrect() {
- final long expectedSize = 136;
-
- final File folder = new File(path);
- final long size = getFolderSize(folder);
-
- assertEquals(expectedSize, size);
- }
-
- @Test
- public void whenGetFolderSizeUsingJava7_thenCorrect() throws IOException {
- final long expectedSize = 136;
-
- final AtomicLong size = new AtomicLong(0);
- final Path folder = Paths.get(path);
-
- Files.walkFileTree(folder, new SimpleFileVisitor() {
- @Override
- public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
- size.addAndGet(attrs.size());
- return FileVisitResult.CONTINUE;
- }
- });
-
- assertEquals(expectedSize, size.longValue());
- }
-
- @Test
- public void whenGetFolderSizeUsingJava8_thenCorrect() throws IOException {
- final long expectedSize = 136;
-
- final Path folder = Paths.get(path);
- final long size = Files.walk(folder).filter(p -> p.toFile().isFile()).mapToLong(p -> p.toFile().length()).sum();
-
- assertEquals(expectedSize, size);
- }
-
- @Test
- public void whenGetFolderSizeUsingApacheCommonsIO_thenCorrect() {
- final long expectedSize = 136;
-
- final File folder = new File(path);
- final long size = FileUtils.sizeOfDirectory(folder);
-
- assertEquals(expectedSize, size);
- }
-
- @Test
- public void whenGetFolderSizeUsingGuava_thenCorrect() {
- final long expectedSize = 136;
-
- final File folder = new File(path);
-
- final Iterable files = com.google.common.io.Files.fileTreeTraverser().breadthFirstTraversal(folder);
- final long size = StreamSupport.stream(files.spliterator(), false)
- .filter(File::isFile)
- .mapToLong(File::length).sum();
-
- assertEquals(expectedSize, size);
- }
-
- @Test
- public void whenGetReadableSize_thenCorrect() {
- final File folder = new File(path);
- final long size = getFolderSize(folder);
-
- final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"};
- final int unitIndex = (int) (Math.log10(size) / 3);
- final double unitValue = 1 << (unitIndex * 10);
-
- final String readableSize = new DecimalFormat("#,##0.#").format(size / unitValue) + " " + units[unitIndex];
- assertEquals("136 B", readableSize);
- }
-
- private long getFolderSize(final File folder) {
- long length = 0;
- final File[] files = folder.listFiles();
-
- for (File file : files) {
- if (file.isFile()) {
- length += file.length();
- } else {
- length += getFolderSize(file);
- }
- }
- return length;
- }
-}
\ No newline at end of file
diff --git a/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesTest.java b/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesTest.java
deleted file mode 100644
index 224c4e9d6a..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/JavaTryWithResourcesTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.baeldung.java8;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Date;
-import java.util.Scanner;
-
-public class JavaTryWithResourcesTest {
-
- private static final String TEST_STRING_HELLO_WORLD = "Hello World";
- private Date resource1Date, resource2Date;
-
- // tests
-
- /* Example for using Try_with_resources */
- @Test
- public void whenWritingToStringWriter_thenCorrectlyWritten() {
- final StringWriter sw = new StringWriter();
- try (PrintWriter pw = new PrintWriter(sw, true)) {
- pw.print(TEST_STRING_HELLO_WORLD);
- }
-
- Assert.assertEquals(sw.getBuffer().toString(), TEST_STRING_HELLO_WORLD);
- }
-
- /* Example for using multiple resources */
- @Test
- public void givenStringToScanner_whenWritingToStringWriter_thenCorrectlyWritten() {
-
- final StringWriter sw = new StringWriter();
- try (Scanner sc = new Scanner(TEST_STRING_HELLO_WORLD); PrintWriter pw = new PrintWriter(sw, true)) {
- while (sc.hasNext()) {
- pw.print(sc.nextLine());
- }
- }
-
- Assert.assertEquals(sw.getBuffer().toString(), TEST_STRING_HELLO_WORLD);
- }
-
- /* Example to show order in which the resources are closed */
- @Test
- public void whenFirstAutoClosableResourceIsinitializedFirst_thenFirstAutoClosableResourceIsReleasedFirst() throws Exception {
- try (AutoCloseableResourcesFirst af = new AutoCloseableResourcesFirst(); AutoCloseableResourcesSecond as = new AutoCloseableResourcesSecond()) {
- af.doSomething();
- as.doSomething();
- }
- Assert.assertTrue(resource1Date.after(resource2Date));
- }
-
- class AutoCloseableResourcesFirst implements AutoCloseable {
- public AutoCloseableResourcesFirst() {
- System.out.println("Constructor -> AutoCloseableResources_First");
- }
-
- public void doSomething() {
- System.out.println("Something -> AutoCloseableResources_First");
- }
-
- @Override
- public void close() throws Exception {
- System.out.println("Closed AutoCloseableResources_First");
- resource1Date = new Date();
- }
- }
-
- class AutoCloseableResourcesSecond implements AutoCloseable {
- public AutoCloseableResourcesSecond() {
- System.out.println("Constructor -> AutoCloseableResources_Second");
- }
-
- public void doSomething() {
- System.out.println("Something -> AutoCloseableResources_Second");
- }
-
- @Override
- public void close() throws Exception {
- System.out.println("Closed AutoCloseableResources_Second");
- resource2Date = new Date();
- Thread.sleep(10000);
- }
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeTest.java b/core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeTest.java
deleted file mode 100644
index 164a571817..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/base64/ApacheCommonsEncodeDecodeTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.baeldung.java8.base64;
-
-import org.apache.commons.codec.binary.Base64;
-import org.junit.Test;
-
-import java.io.UnsupportedEncodingException;
-
-import static org.junit.Assert.*;
-
-public class ApacheCommonsEncodeDecodeTest {
-
- // tests
-
- @Test
- public void whenStringIsEncoded() throws UnsupportedEncodingException {
- final String originalInput = "test input";
- final Base64 base64 = new Base64();
- final String encodedString = new String(base64.encode(originalInput.getBytes()));
-
- assertNotNull(encodedString);
- assertNotEquals(originalInput, encodedString);
- }
-
- @Test
- public void whenStringIsEncoded_thenStringCanBeDecoded() throws UnsupportedEncodingException {
- final String originalInput = "test input";
- final Base64 base64 = new Base64();
- final String encodedString = new String(base64.encode(originalInput.getBytes()));
-
- final String decodedString = new String(base64.decode(encodedString.getBytes()));
-
- assertNotNull(decodedString);
- assertEquals(originalInput, decodedString);
- }
-
- @Test
- public void whenStringIsEncodedUsingStaticMethod() throws UnsupportedEncodingException {
- final String originalInput = "test input";
- final String encodedString = new String(Base64.encodeBase64(originalInput.getBytes()));
-
- assertNotNull(encodedString);
- assertNotEquals(originalInput, encodedString);
- }
-
- @Test
- public void whenStringIsEncodedUsingStaticMethod_thenStringCanBeDecodedUsingStaticMethod() throws UnsupportedEncodingException {
- final String originalInput = "test input";
- final String encodedString = new String(Base64.encodeBase64(originalInput.getBytes()));
-
- final String decodedString = new String(Base64.decodeBase64(encodedString.getBytes()));
-
- assertNotNull(decodedString);
- assertEquals(originalInput, decodedString);
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeTest.java b/core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeTest.java
deleted file mode 100644
index 18dccf71ba..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/base64/Java8EncodeDecodeTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.baeldung.java8.base64;
-
-import org.junit.Test;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Base64;
-import java.util.UUID;
-
-import static org.junit.Assert.*;
-
-public class Java8EncodeDecodeTest {
-
- // tests
-
- @Test
- public void whenStringIsEncoded_thenOk() throws UnsupportedEncodingException {
- final String originalInput = "test input";
- final String encodedString = Base64.getEncoder().encodeToString(originalInput.getBytes());
-
- assertNotNull(encodedString);
- assertNotEquals(originalInput, encodedString);
- }
-
- @Test
- public void whenStringIsEncoded_thenStringCanBeDecoded() throws UnsupportedEncodingException {
- final String originalInput = "test input";
- final String encodedString = Base64.getEncoder().encodeToString(originalInput.getBytes());
-
- final byte[] decodedBytes = Base64.getDecoder().decode(encodedString);
- final String decodedString = new String(decodedBytes);
-
- assertNotNull(decodedString);
- assertEquals(originalInput, decodedString);
- }
-
- @Test
- public void whenStringIsEncodedWithoutPadding_thenOk() throws UnsupportedEncodingException {
- final String originalInput = "test input";
- final String encodedString = Base64.getEncoder().withoutPadding().encodeToString(originalInput.getBytes());
-
- assertNotNull(encodedString);
- assertNotEquals(originalInput, encodedString);
- }
-
- @Test
- public void whenStringIsEncodedWithoutPadding_thenStringCanBeDecoded() throws UnsupportedEncodingException {
- final String originalInput = "test input";
- final String encodedString = Base64.getEncoder().withoutPadding().encodeToString(originalInput.getBytes());
-
- final byte[] decodedBytes = Base64.getDecoder().decode(encodedString);
- final String decodedString = new String(decodedBytes);
-
- assertNotNull(decodedString);
- assertEquals(originalInput, decodedString);
- }
-
- @Test
- public void whenUrlIsEncoded_thenOk() throws UnsupportedEncodingException {
- final String originalUrl = "https://www.google.co.nz/?gfe_rd=cr&ei=dzbFVf&gws_rd=ssl#q=java";
- final String encodedUrl = Base64.getUrlEncoder().encodeToString(originalUrl.getBytes());
- assertNotNull(encodedUrl);
- assertNotEquals(originalUrl, encodedUrl);
- }
-
- @Test
- public void whenUrlIsEncoded_thenURLCanBeDecoded() throws UnsupportedEncodingException {
- final String originalUrl = "https://www.google.co.nz/?gfe_rd=cr&ei=dzbFVf&gws_rd=ssl#q=java";
- final String encodedUrl = Base64.getUrlEncoder().encodeToString(originalUrl.getBytes());
-
- final byte[] decodedBytes = Base64.getUrlDecoder().decode(encodedUrl.getBytes());
- final String decodedUrl = new String(decodedBytes);
-
- assertNotNull(decodedUrl);
- assertEquals(originalUrl, decodedUrl);
- }
-
- @Test
- public void whenMimeIsEncoded_thenOk() throws UnsupportedEncodingException {
- final StringBuilder buffer = getMimeBuffer();
-
- final byte[] forEncode = buffer.toString().getBytes();
- final String encodedMime = Base64.getMimeEncoder().encodeToString(forEncode);
-
- assertNotNull(encodedMime);
- }
-
- @Test
- public void whenMimeIsEncoded_thenItCanBeDecoded() throws UnsupportedEncodingException {
- final StringBuilder buffer = getMimeBuffer();
-
- final byte[] forEncode = buffer.toString().getBytes();
- final String encodedMime = Base64.getMimeEncoder().encodeToString(forEncode);
-
- final byte[] decodedBytes = Base64.getMimeDecoder().decode(encodedMime);
- final String decodedMime = new String(decodedBytes);
- assertNotNull(decodedMime);
- }
-
- //
-
- private static StringBuilder getMimeBuffer() {
- final StringBuilder buffer = new StringBuilder();
- for (int count = 0; count < 10; ++count) {
- buffer.append(UUID.randomUUID().toString());
- }
- return buffer;
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/java8/entity/Human.java b/core-java-8/src/test/java/com/baeldung/java8/entity/Human.java
deleted file mode 100644
index cab8546129..0000000000
--- a/core-java-8/src/test/java/com/baeldung/java8/entity/Human.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package com.baeldung.java8.entity;
-
-public class Human {
- private String name;
- private int age;
-
- public Human() {
- super();
- }
-
- public Human(final String name, final int age) {
- super();
-
- this.name = name;
- this.age = age;
- }
-
- // API
-
- public String getName() {
- return name;
- }
-
- public void setName(final String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(final int age) {
- this.age = age;
- }
-
- // compare
-
- public static int compareByNameThenAge(final Human lhs, final Human rhs) {
- if (lhs.name.equals(rhs.name)) {
- return lhs.age - rhs.age;
- } else {
- return lhs.name.compareTo(rhs.name);
- }
- }
-
- //
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + age;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final Human other = (Human) obj;
- if (age != other.age) {
- return false;
- }
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- final StringBuilder builder = new StringBuilder();
- builder.append("Human [name=").append(name).append(", age=").append(age).append("]");
- return builder.toString();
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/threadpool/CoreThreadPoolTest.java b/core-java-8/src/test/java/com/baeldung/threadpool/CoreThreadPoolTest.java
deleted file mode 100644
index df336f4a93..0000000000
--- a/core-java-8/src/test/java/com/baeldung/threadpool/CoreThreadPoolTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package com.baeldung.threadpool;
-
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class CoreThreadPoolTest {
-
- @Test(timeout = 1000)
- public void whenCallingExecuteWithRunnable_thenRunnableIsExecuted() throws InterruptedException {
-
- CountDownLatch lock = new CountDownLatch(1);
-
- Executor executor = Executors.newSingleThreadExecutor();
- executor.execute(() -> {
- System.out.println("Hello World");
- lock.countDown();
- });
-
- lock.await(1000, TimeUnit.MILLISECONDS);
- }
-
- @Test
- public void whenUsingExecutorServiceAndFuture_thenCanWaitOnFutureResult() throws InterruptedException, ExecutionException {
-
- ExecutorService executorService = Executors.newFixedThreadPool(10);
- Future future = executorService.submit(() -> "Hello World");
- String result = future.get();
-
- assertEquals("Hello World", result);
-
- }
-
- @Test
- public void whenUsingFixedThreadPool_thenCoreAndMaximumThreadSizeAreTheSame() {
-
- ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(2);
- executor.submit(() -> {
- Thread.sleep(1000);
- return null;
- });
- executor.submit(() -> {
- Thread.sleep(1000);
- return null;
- });
- executor.submit(() -> {
- Thread.sleep(1000);
- return null;
- });
-
- assertEquals(2, executor.getPoolSize());
- assertEquals(1, executor.getQueue().size());
-
- }
-
- @Test
- public void whenUsingCachedThreadPool_thenPoolSizeGrowsUnbounded() {
- ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool();
- executor.submit(() -> {
- Thread.sleep(1000);
- return null;
- });
- executor.submit(() -> {
- Thread.sleep(1000);
- return null;
- });
- executor.submit(() -> {
- Thread.sleep(1000);
- return null;
- });
-
- assertEquals(3, executor.getPoolSize());
- assertEquals(0, executor.getQueue().size());
-
- }
-
- @Test(timeout = 1000)
- public void whenUsingSingleThreadPool_thenTasksExecuteSequentially() throws InterruptedException {
-
- CountDownLatch lock = new CountDownLatch(2);
- AtomicInteger counter = new AtomicInteger();
-
- ExecutorService executor = Executors.newSingleThreadExecutor();
- executor.submit(() -> {
- counter.set(1);
- lock.countDown();
- });
- executor.submit(() -> {
- counter.compareAndSet(1, 2);
- lock.countDown();
- });
-
- lock.await(1000, TimeUnit.MILLISECONDS);
- assertEquals(2, counter.get());
-
- }
-
- @Test(timeout = 1000)
- public void whenSchedulingTask_thenTaskExecutesWithinGivenPeriod() throws InterruptedException {
-
- CountDownLatch lock = new CountDownLatch(1);
-
- ScheduledExecutorService executor = Executors.newScheduledThreadPool(5);
- executor.schedule(() -> {
- System.out.println("Hello World");
- lock.countDown();
- }, 500, TimeUnit.MILLISECONDS);
-
- lock.await(1000, TimeUnit.MILLISECONDS);
-
- }
-
- @Test(timeout = 1000)
- public void whenSchedulingTaskWithFixedPeriod_thenTaskExecutesMultipleTimes() throws InterruptedException {
-
- CountDownLatch lock = new CountDownLatch(3);
-
- ScheduledExecutorService executor = Executors.newScheduledThreadPool(5);
- ScheduledFuture> future = executor.scheduleAtFixedRate(() -> {
- System.out.println("Hello World");
- lock.countDown();
- }, 500, 100, TimeUnit.MILLISECONDS);
-
- lock.await();
- future.cancel(true);
-
- }
-
- @Test
- public void whenUsingForkJoinPool_thenSumOfTreeElementsIsCalculatedCorrectly() {
-
- TreeNode tree = new TreeNode(5,
- new TreeNode(3), new TreeNode(2,
- new TreeNode(2), new TreeNode(8)));
-
- ForkJoinPool forkJoinPool = ForkJoinPool.commonPool();
- int sum = forkJoinPool.invoke(new CountingTask(tree));
-
- assertEquals(20, sum);
- }
-
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/threadpool/GuavaThreadPoolTest.java b/core-java-8/src/test/java/com/baeldung/threadpool/GuavaThreadPoolTest.java
deleted file mode 100644
index 92e0f9a8cb..0000000000
--- a/core-java-8/src/test/java/com/baeldung/threadpool/GuavaThreadPoolTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.baeldung.threadpool;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.stream.Collectors;
-
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class GuavaThreadPoolTest {
-
- @Test
- public void whenExecutingTaskWithDirectExecutor_thenTheTaskIsExecutedInTheCurrentThread() {
-
- Executor executor = MoreExecutors.directExecutor();
-
- AtomicBoolean executed = new AtomicBoolean();
-
- executor.execute(() -> {
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- executed.set(true);
- });
-
- assertTrue(executed.get());
- }
-
- @Test
- public void whenJoiningFuturesWithAllAsList_thenCombinedFutureCompletesAfterAllFuturesComplete() throws ExecutionException, InterruptedException {
-
- ExecutorService executorService = Executors.newCachedThreadPool();
- ListeningExecutorService listeningExecutorService = MoreExecutors.listeningDecorator(executorService);
-
- ListenableFuture future1 = listeningExecutorService.submit(() -> "Hello");
- ListenableFuture future2 = listeningExecutorService.submit(() -> "World");
-
- String greeting = Futures.allAsList(future1, future2).get()
- .stream()
- .collect(Collectors.joining(" "));
- assertEquals("Hello World", greeting);
-
- }
-
-}
diff --git a/core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeTest.java b/core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeTest.java
deleted file mode 100644
index da9027060e..0000000000
--- a/core-java-8/src/test/java/com/baeldung/util/CurrentDateTimeTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.baeldung.util;
-
-import org.junit.Test;
-
-import java.time.*;
-import java.time.temporal.ChronoField;
-
-import static org.junit.Assert.assertEquals;
-
-public class CurrentDateTimeTest {
-
- private static final Clock clock = Clock.fixed(Instant.parse("2016-10-09T15:10:30.00Z"), ZoneId.of("UTC"));
-
- @Test
- public void shouldReturnCurrentDate() {
-
- final LocalDate now = LocalDate.now(clock);
-
- assertEquals(9, now.get(ChronoField.DAY_OF_MONTH));
- assertEquals(10, now.get(ChronoField.MONTH_OF_YEAR));
- assertEquals(2016, now.get(ChronoField.YEAR));
- }
-
- @Test
- public void shouldReturnCurrentTime() {
-
- final LocalTime now = LocalTime.now(clock);
-
- assertEquals(15, now.get(ChronoField.HOUR_OF_DAY));
- assertEquals(10, now.get(ChronoField.MINUTE_OF_HOUR));
- assertEquals(30, now.get(ChronoField.SECOND_OF_MINUTE));
- }
-
- @Test
- public void shouldReturnCurrentTimestamp() {
-
- final Instant now = Instant.now(clock);
-
- assertEquals(clock.instant().getEpochSecond(), now.getEpochSecond());
- }
-}
diff --git a/core-java-8/src/test/resources/test.txt b/core-java-8/src/test/resources/test.txt
deleted file mode 100644
index 652d70630f..0000000000
--- a/core-java-8/src/test/resources/test.txt
+++ /dev/null
@@ -1 +0,0 @@
-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse facilisis neque sed turpis venenatis, non dignissim risus volutpat.
\ No newline at end of file
diff --git a/core-java/README.md b/core-java/README.md
index fbbfa65589..48f0677461 100644
--- a/core-java/README.md
+++ b/core-java/README.md
@@ -19,3 +19,20 @@
- [Guide to the Java ArrayList](http://www.baeldung.com/java-arraylist)
- [Guide to Java Reflection](http://www.baeldung.com/java-reflection)
- [A Guide to Java Sockets](http://www.baeldung.com/a-guide-to-java-sockets)
+- [Java 8 Collectors](http://www.baeldung.com/java-8-collectors)
+- [Guide To CompletableFuture](http://www.baeldung.com/java-completablefuture)
+- [Guide to Java 8’s Functional Interfaces](http://www.baeldung.com/java-8-functional-interfaces)
+- [Convert char to String in Java](http://www.baeldung.com/java-convert-char-to-string)
+- [Random List Element](http://www.baeldung.com/java-random-list-element)
+- [Convert String to int or Integer in Java](http://www.baeldung.com/java-convert-string-to-int-or-integer)
+- [Java 8 – Powerful Comparison with Lambdas](http://www.baeldung.com/java-8-sort-lambda)
+- [Java – Directory Size](http://www.baeldung.com/java-folder-size)
+- [Java – Try with Resources](http://www.baeldung.com/java-try-with-resources)
+- [A Guide to the Java ExecutorService](http://www.baeldung.com/java-executor-service-tutorial)
+- [Java 8 New Features](http://www.baeldung.com/java-8-new-features)
+- [Lambda Expressions and Functional Interfaces: Tips and Best Practices](http://www.baeldung.com/java-8-lambda-expressions-tips)
+- [The Double Colon Operator in Java 8](http://www.baeldung.com/java-8-double-colon-operator)
+- [Java 8 Streams Advanced](http://www.baeldung.com/java-8-streams)
+- [Introduction to Thread Pools in Java](http://www.baeldung.com/thread-pool-java-and-guava)
+- [Introduction to Java 8 Streams](http://www.baeldung.com/java-8-streams-introduction)
+- [Guide to the Fork/Join Framework in Java](http://www.baeldung.com/java-fork-join)
\ No newline at end of file
diff --git a/core-java-8/.gitignore b/core-java/src/main/java/com/baeldung/.gitignore
similarity index 100%
rename from core-java-8/.gitignore
rename to core-java/src/main/java/com/baeldung/.gitignore
diff --git a/core-java-8/src/main/java/com/baeldung/Adder.java b/core-java/src/main/java/com/baeldung/Adder.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/Adder.java
rename to core-java/src/main/java/com/baeldung/Adder.java
diff --git a/core-java-8/src/main/java/com/baeldung/AdderImpl.java b/core-java/src/main/java/com/baeldung/AdderImpl.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/AdderImpl.java
rename to core-java/src/main/java/com/baeldung/AdderImpl.java
diff --git a/core-java-8/src/main/java/com/baeldung/Bar.java b/core-java/src/main/java/com/baeldung/Bar.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/Bar.java
rename to core-java/src/main/java/com/baeldung/Bar.java
diff --git a/core-java-8/src/main/java/com/baeldung/Baz.java b/core-java/src/main/java/com/baeldung/Baz.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/Baz.java
rename to core-java/src/main/java/com/baeldung/Baz.java
diff --git a/core-java-8/src/main/java/com/baeldung/Foo.java b/core-java/src/main/java/com/baeldung/Foo.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/Foo.java
rename to core-java/src/main/java/com/baeldung/Foo.java
diff --git a/core-java-8/src/main/java/com/baeldung/FooExtended.java b/core-java/src/main/java/com/baeldung/FooExtended.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/FooExtended.java
rename to core-java/src/main/java/com/baeldung/FooExtended.java
diff --git a/core-java-8/src/main/java/com/baeldung/UseFoo.java b/core-java/src/main/java/com/baeldung/UseFoo.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/UseFoo.java
rename to core-java/src/main/java/com/baeldung/UseFoo.java
diff --git a/core-java-8/src/main/java/com/baeldung/datetime/README.md b/core-java/src/main/java/com/baeldung/datetime/README.md
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/datetime/README.md
rename to core-java/src/main/java/com/baeldung/datetime/README.md
diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseDuration.java b/core-java/src/main/java/com/baeldung/datetime/UseDuration.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/datetime/UseDuration.java
rename to core-java/src/main/java/com/baeldung/datetime/UseDuration.java
diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDate.java b/core-java/src/main/java/com/baeldung/datetime/UseLocalDate.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/datetime/UseLocalDate.java
rename to core-java/src/main/java/com/baeldung/datetime/UseLocalDate.java
diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java b/core-java/src/main/java/com/baeldung/datetime/UseLocalDateTime.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/datetime/UseLocalDateTime.java
rename to core-java/src/main/java/com/baeldung/datetime/UseLocalDateTime.java
diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseLocalTime.java b/core-java/src/main/java/com/baeldung/datetime/UseLocalTime.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/datetime/UseLocalTime.java
rename to core-java/src/main/java/com/baeldung/datetime/UseLocalTime.java
diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UsePeriod.java b/core-java/src/main/java/com/baeldung/datetime/UsePeriod.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/datetime/UsePeriod.java
rename to core-java/src/main/java/com/baeldung/datetime/UsePeriod.java
diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseToInstant.java b/core-java/src/main/java/com/baeldung/datetime/UseToInstant.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/datetime/UseToInstant.java
rename to core-java/src/main/java/com/baeldung/datetime/UseToInstant.java
diff --git a/core-java-8/src/main/java/com/baeldung/datetime/UseZonedDateTime.java b/core-java/src/main/java/com/baeldung/datetime/UseZonedDateTime.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/datetime/UseZonedDateTime.java
rename to core-java/src/main/java/com/baeldung/datetime/UseZonedDateTime.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java b/core-java/src/main/java/com/baeldung/doublecolon/Computer.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/Computer.java
rename to core-java/src/main/java/com/baeldung/doublecolon/Computer.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java b/core-java/src/main/java/com/baeldung/doublecolon/ComputerUtils.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/ComputerUtils.java
rename to core-java/src/main/java/com/baeldung/doublecolon/ComputerUtils.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java b/core-java/src/main/java/com/baeldung/doublecolon/MacbookPro.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/MacbookPro.java
rename to core-java/src/main/java/com/baeldung/doublecolon/MacbookPro.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java b/core-java/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java
rename to core-java/src/main/java/com/baeldung/doublecolon/function/ComputerPredicate.java
diff --git a/core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java b/core-java/src/main/java/com/baeldung/doublecolon/function/TriFunction.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/doublecolon/function/TriFunction.java
rename to core-java/src/main/java/com/baeldung/doublecolon/function/TriFunction.java
diff --git a/core-java/src/main/java/com/baeldung/enums/Pizza.java b/core-java/src/main/java/com/baeldung/enums/Pizza.java
index 7742781081..5bc2d9a9eb 100644
--- a/core-java/src/main/java/com/baeldung/enums/Pizza.java
+++ b/core-java/src/main/java/com/baeldung/enums/Pizza.java
@@ -1,11 +1,5 @@
package com.baeldung.enums;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.commons.collections15.Predicate;
-
-import java.io.IOException;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.List;
@@ -13,13 +7,12 @@ import java.util.stream.Collectors;
public class Pizza {
- private static EnumSet undeliveredPizzaStatuses =
- EnumSet.of(PizzaStatus.ORDERED, PizzaStatus.READY);
+ private static EnumSet deliveredPizzaStatuses =
+ EnumSet.of(PizzaStatusEnum.DELIVERED);
- private PizzaStatus status;
+ private PizzaStatusEnum status;
- @JsonFormat(shape = JsonFormat.Shape.OBJECT)
- public enum PizzaStatus {
+ public enum PizzaStatusEnum {
ORDERED(5) {
@Override
public boolean isOrdered() {
@@ -53,21 +46,20 @@ public class Pizza {
return false;
}
- @JsonProperty("timeToDelivery")
public int getTimeToDelivery() {
return timeToDelivery;
}
- PizzaStatus(int timeToDelivery) {
+ PizzaStatusEnum(int timeToDelivery) {
this.timeToDelivery = timeToDelivery;
}
}
- public PizzaStatus getStatus() {
+ public PizzaStatusEnum getStatus() {
return status;
}
- public void setStatus(PizzaStatus status) {
+ public void setStatus(PizzaStatusEnum status) {
this.status = status;
}
@@ -80,31 +72,20 @@ public class Pizza {
}
public static List getAllUndeliveredPizzas(List input) {
- return input.stream().filter(
- (s) -> undeliveredPizzaStatuses.contains(s.getStatus()))
- .collect(Collectors.toList());
+ return input.stream().filter((s) -> !deliveredPizzaStatuses.contains(s.getStatus())).collect(Collectors.toList());
}
- public static EnumMap>
- groupPizzaByStatus(List pzList) {
+ public static EnumMap> groupPizzaByStatus(List pzList) {
return pzList.stream().collect(
Collectors.groupingBy(Pizza::getStatus,
- () -> new EnumMap<>(PizzaStatus.class), Collectors.toList()));
+ () -> new EnumMap<>(PizzaStatusEnum.class), Collectors.toList()));
}
public void deliver() {
if (isDeliverable()) {
PizzaDeliverySystemConfiguration.getInstance().getDeliveryStrategy().deliver(this);
- this.setStatus(PizzaStatus.DELIVERED);
+ this.setStatus(PizzaStatusEnum.DELIVERED);
}
}
- public static String getJsonString(Pizza pz) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(pz);
- }
-
- private static Predicate thatAreNotDelivered() {
- return entry -> undeliveredPizzaStatuses.contains(entry.getStatus());
- }
}
\ No newline at end of file
diff --git a/core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java b/core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java
index a276b3c000..5ccff5e959 100644
--- a/core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java
+++ b/core-java/src/main/java/com/baeldung/enums/PizzaDeliverySystemConfiguration.java
@@ -1,5 +1,6 @@
package com.baeldung.enums;
+
public enum PizzaDeliverySystemConfiguration {
INSTANCE;
diff --git a/core-java-8/src/main/java/com/baeldung/enums/README.md b/core-java/src/main/java/com/baeldung/enums/README.md
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/enums/README.md
rename to core-java/src/main/java/com/baeldung/enums/README.md
diff --git a/core-java-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java b/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java
rename to core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveAction.java
diff --git a/core-java-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java b/core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java
rename to core-java/src/main/java/com/baeldung/forkjoin/CustomRecursiveTask.java
diff --git a/core-java-8/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java b/core-java/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java
rename to core-java/src/main/java/com/baeldung/forkjoin/util/PoolUtil.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Address.java b/core-java/src/main/java/com/baeldung/java_8_features/Address.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/Address.java
rename to core-java/src/main/java/com/baeldung/java_8_features/Address.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java b/core-java/src/main/java/com/baeldung/java_8_features/CustomException.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/CustomException.java
rename to core-java/src/main/java/com/baeldung/java_8_features/CustomException.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Detail.java b/core-java/src/main/java/com/baeldung/java_8_features/Detail.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/Detail.java
rename to core-java/src/main/java/com/baeldung/java_8_features/Detail.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java b/core-java/src/main/java/com/baeldung/java_8_features/OptionalAddress.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/OptionalAddress.java
rename to core-java/src/main/java/com/baeldung/java_8_features/OptionalAddress.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java b/core-java/src/main/java/com/baeldung/java_8_features/OptionalUser.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/OptionalUser.java
rename to core-java/src/main/java/com/baeldung/java_8_features/OptionalUser.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/User.java b/core-java/src/main/java/com/baeldung/java_8_features/User.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/User.java
rename to core-java/src/main/java/com/baeldung/java_8_features/User.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java b/core-java/src/main/java/com/baeldung/java_8_features/Vehicle.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/Vehicle.java
rename to core-java/src/main/java/com/baeldung/java_8_features/Vehicle.java
diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java b/core-java/src/main/java/com/baeldung/java_8_features/VehicleImpl.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/java_8_features/VehicleImpl.java
rename to core-java/src/main/java/com/baeldung/java_8_features/VehicleImpl.java
diff --git a/core-java-8/src/main/java/com/baeldung/streamApi/Product.java b/core-java/src/main/java/com/baeldung/streamApi/Product.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/streamApi/Product.java
rename to core-java/src/main/java/com/baeldung/streamApi/Product.java
diff --git a/core-java-8/src/main/java/com/baeldung/threadpool/CountingTask.java b/core-java/src/main/java/com/baeldung/threadpool/CountingTask.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/threadpool/CountingTask.java
rename to core-java/src/main/java/com/baeldung/threadpool/CountingTask.java
diff --git a/core-java-8/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java b/core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java
rename to core-java/src/main/java/com/baeldung/threadpool/ExitingExecutorServiceExample.java
diff --git a/core-java-8/src/main/java/com/baeldung/threadpool/TreeNode.java b/core-java/src/main/java/com/baeldung/threadpool/TreeNode.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/threadpool/TreeNode.java
rename to core-java/src/main/java/com/baeldung/threadpool/TreeNode.java
diff --git a/core-java-8/src/main/java/com/baeldung/unzip/UnzipFile.java b/core-java/src/main/java/com/baeldung/unzip/UnzipFile.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/unzip/UnzipFile.java
rename to core-java/src/main/java/com/baeldung/unzip/UnzipFile.java
diff --git a/core-java-8/src/main/java/com/baeldung/zip/ZipDirectory.java b/core-java/src/main/java/com/baeldung/zip/ZipDirectory.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/zip/ZipDirectory.java
rename to core-java/src/main/java/com/baeldung/zip/ZipDirectory.java
diff --git a/core-java-8/src/main/java/com/baeldung/zip/ZipFile.java b/core-java/src/main/java/com/baeldung/zip/ZipFile.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/zip/ZipFile.java
rename to core-java/src/main/java/com/baeldung/zip/ZipFile.java
diff --git a/core-java-8/src/main/java/com/baeldung/zip/ZipMultipleFiles.java b/core-java/src/main/java/com/baeldung/zip/ZipMultipleFiles.java
similarity index 100%
rename from core-java-8/src/main/java/com/baeldung/zip/ZipMultipleFiles.java
rename to core-java/src/main/java/com/baeldung/zip/ZipMultipleFiles.java
diff --git a/core-java-8/src/main/resources/dirCompressed.zip b/core-java/src/main/resources/dirCompressed.zip
similarity index 100%
rename from core-java-8/src/main/resources/dirCompressed.zip
rename to core-java/src/main/resources/dirCompressed.zip
diff --git a/core-java-8/src/main/resources/multiCompressed.zip b/core-java/src/main/resources/multiCompressed.zip
similarity index 100%
rename from core-java-8/src/main/resources/multiCompressed.zip
rename to core-java/src/main/resources/multiCompressed.zip
diff --git a/core-java-8/src/test/java/com/baeldung/CharToStringTest.java b/core-java/src/test/java/com/baeldung/CharToStringTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/CharToStringTest.java
rename to core-java/src/test/java/com/baeldung/CharToStringTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/RandomListElementTest.java b/core-java/src/test/java/com/baeldung/RandomListElementTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/RandomListElementTest.java
rename to core-java/src/test/java/com/baeldung/RandomListElementTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/StringToIntOrIntegerTest.java b/core-java/src/test/java/com/baeldung/StringToIntOrIntegerTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/StringToIntOrIntegerTest.java
rename to core-java/src/test/java/com/baeldung/StringToIntOrIntegerTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java b/core-java/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java
rename to core-java/src/test/java/com/baeldung/collectors/Java8CollectorsTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/completablefuture/CompletableFutureTest.java b/core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/completablefuture/CompletableFutureTest.java
rename to core-java/src/test/java/com/baeldung/completablefuture/CompletableFutureTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/dateapi/ConversionExample.java b/core-java/src/test/java/com/baeldung/dateapi/ConversionExample.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/dateapi/ConversionExample.java
rename to core-java/src/test/java/com/baeldung/dateapi/ConversionExample.java
diff --git a/core-java-8/src/test/java/com/baeldung/dateapi/JavaUtilTimeTest.java b/core-java/src/test/java/com/baeldung/dateapi/JavaUtilTimeTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/dateapi/JavaUtilTimeTest.java
rename to core-java/src/test/java/com/baeldung/dateapi/JavaUtilTimeTest.java
diff --git a/core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceTest.java b/core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceTest.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceTest.java
rename to core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceTest.java
index ce878026d4..e07bcc9a8d 100644
--- a/core-java-8/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceTest.java
+++ b/core-java/src/test/java/com/baeldung/functionalinterface/FunctionalInterfaceTest.java
@@ -1,5 +1,8 @@
package com.baeldung.functionalinterface;
+import com.google.common.util.concurrent.Uninterruptibles;
+import org.junit.Test;
+
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -10,9 +13,6 @@ import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import com.google.common.util.concurrent.Uninterruptibles;
-import org.junit.Test;
-
import static org.junit.Assert.*;
public class FunctionalInterfaceTest {
diff --git a/core-java-8/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java b/core-java/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java
similarity index 100%
rename from core-java-8/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java
rename to core-java/src/test/java/com/baeldung/functionalinterface/ShortToByteFunction.java
diff --git a/feign-client/README.md b/feign/README.md
similarity index 100%
rename from feign-client/README.md
rename to feign/README.md
diff --git a/feign-client/pom.xml b/feign/pom.xml
similarity index 100%
rename from feign-client/pom.xml
rename to feign/pom.xml
diff --git a/feign-client/src/main/java/com/baeldung/feign/BookControllerFeignClientBuilder.java b/feign/src/main/java/com/baeldung/feign/BookControllerFeignClientBuilder.java
similarity index 100%
rename from feign-client/src/main/java/com/baeldung/feign/BookControllerFeignClientBuilder.java
rename to feign/src/main/java/com/baeldung/feign/BookControllerFeignClientBuilder.java
diff --git a/feign-client/src/main/java/com/baeldung/feign/clients/BookClient.java b/feign/src/main/java/com/baeldung/feign/clients/BookClient.java
similarity index 100%
rename from feign-client/src/main/java/com/baeldung/feign/clients/BookClient.java
rename to feign/src/main/java/com/baeldung/feign/clients/BookClient.java
diff --git a/feign-client/src/main/java/com/baeldung/feign/models/Book.java b/feign/src/main/java/com/baeldung/feign/models/Book.java
similarity index 100%
rename from feign-client/src/main/java/com/baeldung/feign/models/Book.java
rename to feign/src/main/java/com/baeldung/feign/models/Book.java
diff --git a/feign-client/src/main/java/com/baeldung/feign/models/BookResource.java b/feign/src/main/java/com/baeldung/feign/models/BookResource.java
similarity index 100%
rename from feign-client/src/main/java/com/baeldung/feign/models/BookResource.java
rename to feign/src/main/java/com/baeldung/feign/models/BookResource.java
diff --git a/feign-client/src/main/resources/log4j2.xml b/feign/src/main/resources/log4j2.xml
similarity index 100%
rename from feign-client/src/main/resources/log4j2.xml
rename to feign/src/main/resources/log4j2.xml
diff --git a/feign-client/src/test/java/com/baeldung/feign/clients/BookClientTest.java b/feign/src/test/java/com/baeldung/feign/clients/BookClientTest.java
similarity index 100%
rename from feign-client/src/test/java/com/baeldung/feign/clients/BookClientTest.java
rename to feign/src/test/java/com/baeldung/feign/clients/BookClientTest.java
diff --git a/flyway-migration/.gitignore b/flyway/.gitignore
similarity index 75%
rename from flyway-migration/.gitignore
rename to flyway/.gitignore
index abffe04ed2..9cdd5b9542 100644
--- a/flyway-migration/.gitignore
+++ b/flyway/.gitignore
@@ -1,4 +1,4 @@
-.classpath
-.project
-.settings
+.classpath
+.project
+.settings
target/
\ No newline at end of file
diff --git a/flyway-migration/README.MD b/flyway/README.MD
similarity index 100%
rename from flyway-migration/README.MD
rename to flyway/README.MD
diff --git a/flyway-migration/db/migration/V1_0__create_employee_schema.sql b/flyway/db/migration/V1_0__create_employee_schema.sql
similarity index 77%
rename from flyway-migration/db/migration/V1_0__create_employee_schema.sql
rename to flyway/db/migration/V1_0__create_employee_schema.sql
index 09408faecb..b6167bfacc 100644
--- a/flyway-migration/db/migration/V1_0__create_employee_schema.sql
+++ b/flyway/db/migration/V1_0__create_employee_schema.sql
@@ -1,8 +1,8 @@
-CREATE TABLE IF NOT EXISTS `employee` (
-
-`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
-`name` varchar(20),
-`email` varchar(50),
-`date_of_birth` timestamp
-
+CREATE TABLE IF NOT EXISTS `employee` (
+
+`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
+`name` varchar(20),
+`email` varchar(50),
+`date_of_birth` timestamp
+
)ENGINE=InnoDB DEFAULT CHARSET=UTF8;
\ No newline at end of file
diff --git a/flyway-migration/db/migration/V2_0__create_department_schema.sql b/flyway/db/migration/V2_0__create_department_schema.sql
similarity index 70%
rename from flyway-migration/db/migration/V2_0__create_department_schema.sql
rename to flyway/db/migration/V2_0__create_department_schema.sql
index 2b9d3364a5..c85cc81353 100644
--- a/flyway-migration/db/migration/V2_0__create_department_schema.sql
+++ b/flyway/db/migration/V2_0__create_department_schema.sql
@@ -1,8 +1,8 @@
-CREATE TABLE IF NOT EXISTS `department` (
-
-`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
-`name` varchar(20)
-
-)ENGINE=InnoDB DEFAULT CHARSET=UTF8;
-
+CREATE TABLE IF NOT EXISTS `department` (
+
+`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
+`name` varchar(20)
+
+)ENGINE=InnoDB DEFAULT CHARSET=UTF8;
+
ALTER TABLE `employee` ADD `dept_id` int AFTER `email`;
\ No newline at end of file
diff --git a/flyway-migration/myFlywayConfig.properties b/flyway/myFlywayConfig.properties
similarity index 69%
rename from flyway-migration/myFlywayConfig.properties
rename to flyway/myFlywayConfig.properties
index 22f3afefd3..8bb102930a 100644
--- a/flyway-migration/myFlywayConfig.properties
+++ b/flyway/myFlywayConfig.properties
@@ -1,5 +1,5 @@
-flyway.user=root
-flyway.password=mysql
-flyway.schemas=app-db
-flyway.url=jdbc:mysql://localhost:3306/
+flyway.user=root
+flyway.password=mysql
+flyway.schemas=app-db
+flyway.url=jdbc:mysql://localhost:3306/
flyway.locations=filesystem:db/migration
\ No newline at end of file
diff --git a/flyway-migration/pom.xml b/flyway/pom.xml
similarity index 90%
rename from flyway-migration/pom.xml
rename to flyway/pom.xml
index 6e9d683a0e..d53bc7dc41 100644
--- a/flyway-migration/pom.xml
+++ b/flyway/pom.xml
@@ -1,34 +1,34 @@
-
- 4.0.0
- com.baeldung
- flyway-migration
- 1.0
- flyway-migration
- A sample project to demonstrate Flyway migrations
-
-
- mysql
- mysql-connector-java
- 6.0.3
-
-
-
-
-
- org.flywaydb
- flyway-maven-plugin
- 4.0.3
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.5.1
-
- 1.8
- 1.8
-
-
-
-
+
+ 4.0.0
+ com.baeldung
+ flyway
+ 1.0
+ flyway
+ A sample project to demonstrate Flyway migrations
+
+
+ mysql
+ mysql-connector-java
+ 6.0.3
+
+
+
+
+
+ org.flywaydb
+ flyway-maven-plugin
+ 4.0.3
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.5.1
+
+ 1.8
+ 1.8
+
+
+
+
\ No newline at end of file
diff --git a/jee7schedule/README.md b/jee7/README.md
similarity index 100%
rename from jee7schedule/README.md
rename to jee7/README.md
diff --git a/jee7schedule/pom.xml b/jee7/pom.xml
similarity index 100%
rename from jee7schedule/pom.xml
rename to jee7/pom.xml
diff --git a/jee7schedule/src/main/java/com/baeldung/timer/AutomaticTimerBean.java b/jee7/src/main/java/com/baeldung/timer/AutomaticTimerBean.java
similarity index 100%
rename from jee7schedule/src/main/java/com/baeldung/timer/AutomaticTimerBean.java
rename to jee7/src/main/java/com/baeldung/timer/AutomaticTimerBean.java
diff --git a/jee7schedule/src/main/java/com/baeldung/timer/FixedDelayTimerBean.java b/jee7/src/main/java/com/baeldung/timer/FixedDelayTimerBean.java
similarity index 100%
rename from jee7schedule/src/main/java/com/baeldung/timer/FixedDelayTimerBean.java
rename to jee7/src/main/java/com/baeldung/timer/FixedDelayTimerBean.java
diff --git a/jee7schedule/src/main/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBean.java b/jee7/src/main/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBean.java
similarity index 100%
rename from jee7schedule/src/main/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBean.java
rename to jee7/src/main/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBean.java
diff --git a/jee7schedule/src/main/java/com/baeldung/timer/ProgrammaticTimerBean.java b/jee7/src/main/java/com/baeldung/timer/ProgrammaticTimerBean.java
similarity index 100%
rename from jee7schedule/src/main/java/com/baeldung/timer/ProgrammaticTimerBean.java
rename to jee7/src/main/java/com/baeldung/timer/ProgrammaticTimerBean.java
diff --git a/jee7schedule/src/main/java/com/baeldung/timer/ProgrammaticWithInitialFixedDelayTimerBean.java b/jee7/src/main/java/com/baeldung/timer/ProgrammaticWithInitialFixedDelayTimerBean.java
similarity index 100%
rename from jee7schedule/src/main/java/com/baeldung/timer/ProgrammaticWithInitialFixedDelayTimerBean.java
rename to jee7/src/main/java/com/baeldung/timer/ProgrammaticWithInitialFixedDelayTimerBean.java
diff --git a/jee7schedule/src/main/java/com/baeldung/timer/ScheduleTimerBean.java b/jee7/src/main/java/com/baeldung/timer/ScheduleTimerBean.java
similarity index 100%
rename from jee7schedule/src/main/java/com/baeldung/timer/ScheduleTimerBean.java
rename to jee7/src/main/java/com/baeldung/timer/ScheduleTimerBean.java
diff --git a/jee7schedule/src/main/java/com/baeldung/timer/TimerEvent.java b/jee7/src/main/java/com/baeldung/timer/TimerEvent.java
similarity index 100%
rename from jee7schedule/src/main/java/com/baeldung/timer/TimerEvent.java
rename to jee7/src/main/java/com/baeldung/timer/TimerEvent.java
diff --git a/jee7schedule/src/main/java/com/baeldung/timer/TimerEventListener.java b/jee7/src/main/java/com/baeldung/timer/TimerEventListener.java
similarity index 100%
rename from jee7schedule/src/main/java/com/baeldung/timer/TimerEventListener.java
rename to jee7/src/main/java/com/baeldung/timer/TimerEventListener.java
diff --git a/jee7schedule/src/main/java/com/baeldung/timer/WorkerBean.java b/jee7/src/main/java/com/baeldung/timer/WorkerBean.java
similarity index 100%
rename from jee7schedule/src/main/java/com/baeldung/timer/WorkerBean.java
rename to jee7/src/main/java/com/baeldung/timer/WorkerBean.java
diff --git a/jee7schedule/src/main/webapp/WEB-INF/beans.xml b/jee7/src/main/webapp/WEB-INF/beans.xml
similarity index 100%
rename from jee7schedule/src/main/webapp/WEB-INF/beans.xml
rename to jee7/src/main/webapp/WEB-INF/beans.xml
diff --git a/jee7schedule/src/test/java/com/baeldung/timer/AutomaticTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/AutomaticTimerBeanTest.java
similarity index 100%
rename from jee7schedule/src/test/java/com/baeldung/timer/AutomaticTimerBeanTest.java
rename to jee7/src/test/java/com/baeldung/timer/AutomaticTimerBeanTest.java
diff --git a/jee7schedule/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanTest.java
similarity index 100%
rename from jee7schedule/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanTest.java
rename to jee7/src/test/java/com/baeldung/timer/ProgrammaticAtFixedRateTimerBeanTest.java
diff --git a/jee7schedule/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanTest.java
similarity index 100%
rename from jee7schedule/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanTest.java
rename to jee7/src/test/java/com/baeldung/timer/ProgrammaticTimerBeanTest.java
diff --git a/jee7schedule/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanTest.java
similarity index 100%
rename from jee7schedule/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanTest.java
rename to jee7/src/test/java/com/baeldung/timer/ProgrammaticWithFixedDelayTimerBeanTest.java
diff --git a/jee7schedule/src/test/java/com/baeldung/timer/ScheduleTimerBeanTest.java b/jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanTest.java
similarity index 100%
rename from jee7schedule/src/test/java/com/baeldung/timer/ScheduleTimerBeanTest.java
rename to jee7/src/test/java/com/baeldung/timer/ScheduleTimerBeanTest.java
diff --git a/jee7schedule/src/test/java/com/baeldung/timer/WithinWindowMatcher.java b/jee7/src/test/java/com/baeldung/timer/WithinWindowMatcher.java
similarity index 100%
rename from jee7schedule/src/test/java/com/baeldung/timer/WithinWindowMatcher.java
rename to jee7/src/test/java/com/baeldung/timer/WithinWindowMatcher.java
diff --git a/pom.xml b/pom.xml
index d925cbe7fb..a882945436 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,6 @@
cdi
core-java
- core-java-8
couchbase-sdk
@@ -29,9 +28,11 @@
deltaspike
patterns
- feign-client
+ feign
+ flyway
+
gson
guava
guava18
@@ -45,12 +46,12 @@
jackson
javaxval
jjwt
- jooq-spring
+
jpa-storedprocedure
json
json-path
junit5
- jee7schedule
+ jee7
log4j
@@ -88,8 +89,9 @@
spring-freemarker
spring-hibernate3
spring-hibernate4
- spring-jpa
spring-jms
+ spring-jooq
+ spring-jpa
spring-katharsis
spring-mockito
spring-mvc-java
@@ -127,6 +129,7 @@
jsf
xml
+ xmlunit2
lombok
redis
diff --git a/spring-exceptions/pom.xml b/spring-exceptions/pom.xml
index 12b7e5de79..6994a518fe 100644
--- a/spring-exceptions/pom.xml
+++ b/spring-exceptions/pom.xml
@@ -194,7 +194,7 @@
${maven-surefire-plugin.version}
- **/*IntegrationTest.java
+ **/*ManualTest.java
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java
index f88138fec2..9597c09568 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/BeanCreationExceptionTestSuite.java
@@ -5,15 +5,15 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({ // @formatter:off
- Cause1BeanCreationExceptionIntegrationTest.class
- ,Cause2BeanCreationExceptionIntegrationTest.class
- ,Cause3BeanCreationExceptionIntegrationTest.class
- ,Cause4BeanCreationExceptionIntegrationTest.class
- ,Cause5BeanCreationExceptionIntegrationTest.class
- ,Cause6BeanCreationExceptionIntegrationTest.class
- ,Cause7BeanCreationExceptionIntegrationTest.class
- ,Cause8BeanCreationExceptionIntegrationTest.class
- ,Cause9BeanCreationExceptionIntegrationTest.class
+ Cause1BeanCreationExceptionManualTest.class
+ ,Cause2BeanCreationExceptionManualTest.class
+ ,Cause3BeanCreationExceptionManualTest.class
+ ,Cause4BeanCreationExceptionManualTest.class
+ ,Cause5BeanCreationExceptionManualTest.class
+ ,Cause6BeanCreationExceptionManualTest.class
+ ,Cause7BeanCreationExceptionManualTest.class
+ ,Cause8BeanCreationExceptionManualTest.class
+ ,Cause9BeanCreationExceptionManualTest.class
}) // @formatter:on
public class BeanCreationExceptionTestSuite {
//
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionManualTest.java
index 56d916e25d..350347bb19 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause1BeanCreationExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause1ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause1BeanCreationExceptionIntegrationTest {
+public class Cause1BeanCreationExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionManualTest.java
index 968e7312de..c2b9561848 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause2BeanCreationExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause2ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause2BeanCreationExceptionIntegrationTest {
+public class Cause2BeanCreationExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionManualTest.java
index 4730d59334..7b9b49bf58 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause3BeanCreationExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause3ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause3BeanCreationExceptionIntegrationTest {
+public class Cause3BeanCreationExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionManualTest.java
index b5108c1ab4..3a6e30476c 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause4BeanCreationExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause4ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause4BeanCreationExceptionIntegrationTest {
+public class Cause4BeanCreationExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionManualTest.java
index 9a08ec45a1..e69a323f8d 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause5BeanCreationExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause5ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause5BeanCreationExceptionIntegrationTest {
+public class Cause5BeanCreationExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionManualTest.java
index 423a0a98a9..30fbd47635 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause6BeanCreationExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause6ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause6BeanCreationExceptionIntegrationTest {
+public class Cause6BeanCreationExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionManualTest.java
index a61e598b41..d832bddf72 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause7BeanCreationExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause7ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause7BeanCreationExceptionIntegrationTest {
+public class Cause7BeanCreationExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionManualTest.java
index 8550f307d5..a9f32b6d1a 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause8BeanCreationExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause8ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause8BeanCreationExceptionIntegrationTest {
+public class Cause8BeanCreationExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionManualTest.java
index ad1ba5f2f1..6af5fb3712 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beancreationexception/Cause9BeanCreationExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause9ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause9BeanCreationExceptionIntegrationTest {
+public class Cause9BeanCreationExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionManualTest.java
index 8de51a4bf0..1580546fa7 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause1BeanDefinitionStoreExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause1ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause1BeanDefinitionStoreExceptionIntegrationTest {
+public class Cause1BeanDefinitionStoreExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionManualTest.java
index 8dbc50cda5..ce0db694dc 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause2BeanDefinitionStoreExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause2ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause2BeanDefinitionStoreExceptionIntegrationTest {
+public class Cause2BeanDefinitionStoreExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionManualTest.java
index 370b67e2fa..c090ac7b5f 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/beandefinitionstoreexception/Cause3BeanDefinitionStoreExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause3ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause3BeanDefinitionStoreExceptionIntegrationTest {
+public class Cause3BeanDefinitionStoreExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionManualTest.java
similarity index 96%
rename from spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionManualTest.java
index 0f46481116..056e052359 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause1DataIntegrityViolationExceptionManualTest.java
@@ -15,7 +15,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause1DataContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause1DataIntegrityViolationExceptionIntegrationTest {
+public class Cause1DataIntegrityViolationExceptionManualTest {
@Autowired
private IParentService service;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionManualTest.java
similarity index 93%
rename from spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionManualTest.java
index 0ea0dd2f28..e36a027105 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause2DataIntegrityViolationExceptionManualTest.java
@@ -13,7 +13,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause2DataContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause2DataIntegrityViolationExceptionIntegrationTest {
+public class Cause2DataIntegrityViolationExceptionManualTest {
@Autowired
private IFooService fooService;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionManualTest.java
similarity index 94%
rename from spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionManualTest.java
index 75d5793910..4194e1c9fe 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/dataintegrityviolationexception/Cause3DataIntegrityViolationExceptionManualTest.java
@@ -15,7 +15,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause3DataContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause3DataIntegrityViolationExceptionIntegrationTest {
+public class Cause3DataIntegrityViolationExceptionManualTest {
@Autowired
private IFooService fooService;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause1MappingExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause1MappingExceptionManualTest.java
similarity index 95%
rename from spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause1MappingExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause1MappingExceptionManualTest.java
index 671b0a473e..7ba9618a77 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause1MappingExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause1MappingExceptionManualTest.java
@@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause1PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause1MappingExceptionIntegrationTest {
+public class Cause1MappingExceptionManualTest {
@Autowired
private SessionFactory sessionFactory;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause2MappingExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause2MappingExceptionManualTest.java
similarity index 95%
rename from spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause2MappingExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause2MappingExceptionManualTest.java
index eae5ebd9a2..66923fc6a9 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause2MappingExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause2MappingExceptionManualTest.java
@@ -13,7 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause2PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause2MappingExceptionIntegrationTest {
+public class Cause2MappingExceptionManualTest {
@Autowired
private SessionFactory sessionFactory;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause3MappingExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause3MappingExceptionManualTest.java
similarity index 95%
rename from spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause3MappingExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause3MappingExceptionManualTest.java
index d6abe7db4f..e6888d1685 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause3MappingExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause3MappingExceptionManualTest.java
@@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause3PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause3MappingExceptionIntegrationTest {
+public class Cause3MappingExceptionManualTest {
@Autowired
private SessionFactory sessionFactory;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java
similarity index 96%
rename from spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java
index 864da76e4b..760d082f54 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/mappingexception/Cause4MappingExceptionManualTest.java
@@ -12,7 +12,7 @@ import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
import org.junit.Test;
-public class Cause4MappingExceptionIntegrationTest {
+public class Cause4MappingExceptionManualTest {
// tests
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionManualTest.java
similarity index 95%
rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionManualTest.java
index 84038e4dcf..b7ed103394 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/CannotGetJdbcConnectionExceptionManualTest.java
@@ -18,7 +18,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause5NonTransientConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class CannotGetJdbcConnectionExceptionIntegrationTest {
+public class CannotGetJdbcConnectionExceptionManualTest {
@Autowired
private DataSource restDataSource;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionManualTest.java
similarity index 96%
rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionManualTest.java
index e62a455dd4..b98a210125 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataIntegrityExceptionManualTest.java
@@ -17,7 +17,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause1NonTransientConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class DataIntegrityExceptionIntegrationTest {
+public class DataIntegrityExceptionManualTest {
@Autowired
private IFooService fooService;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionManualTest.java
similarity index 97%
rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionManualTest.java
index 8a7c237708..122278580f 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataRetrievalExceptionManualTest.java
@@ -17,7 +17,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause1NonTransientConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class DataRetrievalExceptionIntegrationTest {
+public class DataRetrievalExceptionManualTest {
@Autowired
private DataSource restDataSource;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionManualTest.java
similarity index 95%
rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionManualTest.java
index 161bf3252b..4da5f94098 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/DataSourceLookupExceptionManualTest.java
@@ -13,7 +13,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause4NonTransientConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class DataSourceLookupExceptionIntegrationTest {
+public class DataSourceLookupExceptionManualTest {
@Test(expected = DataSourceLookupFailureException.class)
public void whenLookupNonExistentDataSource_thenDataSourceLookupFailureException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionManualTest.java
similarity index 96%
rename from spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionManualTest.java
index 316efba0b9..fc420acfe9 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/nontransientdataaccessexception/InvalidResourceUsageExceptionManualTest.java
@@ -16,7 +16,7 @@ import javax.sql.DataSource;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause1NonTransientConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class InvalidResourceUsageExceptionIntegrationTest {
+public class InvalidResourceUsageExceptionManualTest {
@Autowired
private IFooService fooService;
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionManualTest.java
similarity index 93%
rename from spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionManualTest.java
index 1a9711b2d6..45ffdf9096 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause1NoSuchBeanDefinitionExceptionManualTest.java
@@ -15,7 +15,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause1ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause1NoSuchBeanDefinitionExceptionIntegrationTest {
+public class Cause1NoSuchBeanDefinitionExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionManualTest.java
index 90d7317f44..09ed2b4435 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause2NoSuchBeanDefinitionExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause2ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause2NoSuchBeanDefinitionExceptionIntegrationTest {
+public class Cause2NoSuchBeanDefinitionExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionManualTest.java
similarity index 91%
rename from spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionManualTest.java
index 0e2123b7ff..7dc016a568 100644
--- a/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/ex/nosuchbeandefinitionexception/Cause3NoSuchBeanDefinitionExceptionManualTest.java
@@ -9,7 +9,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { Cause3ContextWithJavaConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class Cause3NoSuchBeanDefinitionExceptionIntegrationTest {
+public class Cause3NoSuchBeanDefinitionExceptionManualTest {
@Test
public final void givenContextIsInitialized_thenNoException() {
diff --git a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithJavaIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithJavaManualTest.java
similarity index 95%
rename from spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithJavaIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithJavaManualTest.java
index d6c99502d7..91db8210b3 100644
--- a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithJavaIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithJavaManualTest.java
@@ -13,7 +13,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { PropertiesWithJavaConfig.class, PropertiesWithJavaConfigOther.class }, loader = AnnotationConfigContextLoader.class)
-public class PropertiesWithJavaIntegrationTest {
+public class PropertiesWithJavaManualTest {
@Autowired
private Environment env;
diff --git a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithMultipleXmlsIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithMultipleXmlsManualTest.java
similarity index 95%
rename from spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithMultipleXmlsIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithMultipleXmlsManualTest.java
index 9fc793fc1b..201e554381 100644
--- a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithMultipleXmlsIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithMultipleXmlsManualTest.java
@@ -13,7 +13,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { PropertiesWithXmlConfigOne.class, PropertiesWithXmlConfigTwo.class }, loader = AnnotationConfigContextLoader.class)
-public class PropertiesWithMultipleXmlsIntegrationTest {
+public class PropertiesWithMultipleXmlsManualTest {
@Autowired
private Environment env;
diff --git a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithXmlIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithXmlManualTest.java
similarity index 95%
rename from spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithXmlIntegrationTest.java
rename to spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithXmlManualTest.java
index ff5eaab910..a54dd8a3fb 100644
--- a/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithXmlIntegrationTest.java
+++ b/spring-exceptions/src/test/java/org/baeldung/properties/core/PropertiesWithXmlManualTest.java
@@ -12,7 +12,7 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { PropertiesWithXmlConfig.class }, loader = AnnotationConfigContextLoader.class)
-public class PropertiesWithXmlIntegrationTest {
+public class PropertiesWithXmlManualTest {
@Autowired
private Environment env;
diff --git a/jooq-spring/.gitignore b/spring-jooq/.gitignore
similarity index 100%
rename from jooq-spring/.gitignore
rename to spring-jooq/.gitignore
diff --git a/jooq-spring/README.md b/spring-jooq/README.md
similarity index 100%
rename from jooq-spring/README.md
rename to spring-jooq/README.md
diff --git a/jooq-spring/pom.xml b/spring-jooq/pom.xml
similarity index 100%
rename from jooq-spring/pom.xml
rename to spring-jooq/pom.xml
diff --git a/jooq-spring/src/main/resources/application.properties b/spring-jooq/src/main/resources/application.properties
similarity index 100%
rename from jooq-spring/src/main/resources/application.properties
rename to spring-jooq/src/main/resources/application.properties
diff --git a/jooq-spring/src/main/resources/intro_config.properties b/spring-jooq/src/main/resources/intro_config.properties
similarity index 100%
rename from jooq-spring/src/main/resources/intro_config.properties
rename to spring-jooq/src/main/resources/intro_config.properties
diff --git a/jooq-spring/src/main/resources/intro_schema.sql b/spring-jooq/src/main/resources/intro_schema.sql
similarity index 100%
rename from jooq-spring/src/main/resources/intro_schema.sql
rename to spring-jooq/src/main/resources/intro_schema.sql
diff --git a/jooq-spring/src/test/java/com/baeldung/jooq/introduction/ExceptionTranslator.java b/spring-jooq/src/test/java/com/baeldung/jooq/introduction/ExceptionTranslator.java
similarity index 100%
rename from jooq-spring/src/test/java/com/baeldung/jooq/introduction/ExceptionTranslator.java
rename to spring-jooq/src/test/java/com/baeldung/jooq/introduction/ExceptionTranslator.java
diff --git a/jooq-spring/src/test/java/com/baeldung/jooq/introduction/PersistenceContextIntegrationTest.java b/spring-jooq/src/test/java/com/baeldung/jooq/introduction/PersistenceContextIntegrationTest.java
similarity index 100%
rename from jooq-spring/src/test/java/com/baeldung/jooq/introduction/PersistenceContextIntegrationTest.java
rename to spring-jooq/src/test/java/com/baeldung/jooq/introduction/PersistenceContextIntegrationTest.java
diff --git a/jooq-spring/src/test/java/com/baeldung/jooq/introduction/QueryIntegrationTest.java b/spring-jooq/src/test/java/com/baeldung/jooq/introduction/QueryIntegrationTest.java
similarity index 100%
rename from jooq-spring/src/test/java/com/baeldung/jooq/introduction/QueryIntegrationTest.java
rename to spring-jooq/src/test/java/com/baeldung/jooq/introduction/QueryIntegrationTest.java
diff --git a/jooq-spring/src/test/java/com/baeldung/jooq/springboot/Application.java b/spring-jooq/src/test/java/com/baeldung/jooq/springboot/Application.java
similarity index 100%
rename from jooq-spring/src/test/java/com/baeldung/jooq/springboot/Application.java
rename to spring-jooq/src/test/java/com/baeldung/jooq/springboot/Application.java
diff --git a/jooq-spring/src/test/java/com/baeldung/jooq/springboot/InitialConfiguration.java b/spring-jooq/src/test/java/com/baeldung/jooq/springboot/InitialConfiguration.java
similarity index 100%
rename from jooq-spring/src/test/java/com/baeldung/jooq/springboot/InitialConfiguration.java
rename to spring-jooq/src/test/java/com/baeldung/jooq/springboot/InitialConfiguration.java
diff --git a/jooq-spring/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java b/spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java
similarity index 100%
rename from jooq-spring/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java
rename to spring-jooq/src/test/java/com/baeldung/jooq/springboot/SpringBootIntegrationTest.java
diff --git a/spring-rest-docs/pom.xml b/spring-rest-docs/pom.xml
index 04ee11d0de..8e758eeb4a 100644
--- a/spring-rest-docs/pom.xml
+++ b/spring-rest-docs/pom.xml
@@ -63,7 +63,7 @@
maven-surefire-plugin
- **/*Documentation.java
+ **/*IntegrationTest.java
diff --git a/spring-rest-docs/src/test/java/com/example/ApiDocumentation.java b/spring-rest-docs/src/test/java/com/example/ApiDocumentationIntegrationTest.java
similarity index 99%
rename from spring-rest-docs/src/test/java/com/example/ApiDocumentation.java
rename to spring-rest-docs/src/test/java/com/example/ApiDocumentationIntegrationTest.java
index 5b753aff0c..0912023fb7 100644
--- a/spring-rest-docs/src/test/java/com/example/ApiDocumentation.java
+++ b/spring-rest-docs/src/test/java/com/example/ApiDocumentationIntegrationTest.java
@@ -38,7 +38,7 @@ import static org.springframework.util.StringUtils.collectionToDelimitedString;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SpringRestDocsApplication.class)
@WebAppConfiguration
-public class ApiDocumentation {
+public class ApiDocumentationIntegrationTest {
@Rule
public final RestDocumentation restDocumentation = new RestDocumentation("target/generated-snippets");
diff --git a/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentation.java b/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentationIntegrationTest.java
similarity index 99%
rename from spring-rest-docs/src/test/java/com/example/GettingStartedDocumentation.java
rename to spring-rest-docs/src/test/java/com/example/GettingStartedDocumentationIntegrationTest.java
index 7aea9d303c..1af626d03b 100644
--- a/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentation.java
+++ b/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentationIntegrationTest.java
@@ -33,7 +33,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SpringRestDocsApplication.class)
@WebAppConfiguration
-public class GettingStartedDocumentation {
+public class GettingStartedDocumentationIntegrationTest {
@Rule
public final RestDocumentation restDocumentation = new RestDocumentation("target/generated-snippets");
diff --git a/spring-security-custom-voter/src/main/java/org/baeldung/security/MinuteBasedVoter.java b/spring-security-custom-voter/src/main/java/org/baeldung/security/MinuteBasedVoter.java
index 8d22c52b0d..a08079fcff 100644
--- a/spring-security-custom-voter/src/main/java/org/baeldung/security/MinuteBasedVoter.java
+++ b/spring-security-custom-voter/src/main/java/org/baeldung/security/MinuteBasedVoter.java
@@ -1,15 +1,13 @@
package org.baeldung.security;
+import java.time.LocalDateTime;
+import java.util.Collection;
+
import org.springframework.security.access.AccessDecisionVoter;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
-import java.time.LocalDateTime;
-import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
-
public class MinuteBasedVoter implements AccessDecisionVoter {
@Override
public boolean supports(ConfigAttribute attribute) {
@@ -23,16 +21,13 @@ public class MinuteBasedVoter implements AccessDecisionVoter {
@Override
public int vote(Authentication authentication, Object object, Collection collection) {
- List roles = authentication
+ return authentication
.getAuthorities()
- .stream().map(GrantedAuthority::getAuthority)
- .collect(Collectors.toList());
-
- for (String role: roles) {
- if ("ROLE_USER".equals(role) && LocalDateTime.now().getMinute() % 2 != 0) {
- return ACCESS_DENIED;
- }
- }
- return ACCESS_ABSTAIN;
+ .stream()
+ .map(GrantedAuthority::getAuthority)
+ .filter(r -> "ROLE_USER".equals(r) && LocalDateTime.now().getMinute() % 2 != 0)
+ .findAny()
+ .map(s -> ACCESS_DENIED)
+ .orElseGet(() -> ACCESS_ABSTAIN);
}
}
diff --git a/xmlunit2-tutorial/README.md b/xmlunit2/README.md
similarity index 100%
rename from xmlunit2-tutorial/README.md
rename to xmlunit2/README.md
diff --git a/xmlunit2-tutorial/pom.xml b/xmlunit2/pom.xml
similarity index 96%
rename from xmlunit2-tutorial/pom.xml
rename to xmlunit2/pom.xml
index b4cb684f65..c80e3f37b2 100644
--- a/xmlunit2-tutorial/pom.xml
+++ b/xmlunit2/pom.xml
@@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
com.baeldung
- xmlunit2-tutorial
+ xmlunit2
1.0
XMLUnit-2
diff --git a/xmlunit2-tutorial/src/main/java/com/baeldung/xmlunit/IgnoreAttributeDifferenceEvaluator.java b/xmlunit2/src/main/java/com/baeldung/xmlunit/IgnoreAttributeDifferenceEvaluator.java
similarity index 100%
rename from xmlunit2-tutorial/src/main/java/com/baeldung/xmlunit/IgnoreAttributeDifferenceEvaluator.java
rename to xmlunit2/src/main/java/com/baeldung/xmlunit/IgnoreAttributeDifferenceEvaluator.java
diff --git a/xmlunit2-tutorial/src/test/java/com/baeldung/xmlunit/XMLUnitTest.java b/xmlunit2/src/test/java/com/baeldung/xmlunit/XMLUnitTest.java
similarity index 96%
rename from xmlunit2-tutorial/src/test/java/com/baeldung/xmlunit/XMLUnitTest.java
rename to xmlunit2/src/test/java/com/baeldung/xmlunit/XMLUnitTest.java
index 175250f47b..5af3d48433 100644
--- a/xmlunit2-tutorial/src/test/java/com/baeldung/xmlunit/XMLUnitTest.java
+++ b/xmlunit2/src/test/java/com/baeldung/xmlunit/XMLUnitTest.java
@@ -1,37 +1,30 @@
package com.baeldung.xmlunit;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.core.IsNot.not;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.xmlunit.matchers.CompareMatcher.isIdenticalTo;
-import static org.xmlunit.matchers.CompareMatcher.isSimilarTo;
-import static org.xmlunit.matchers.HasXPathMatcher.hasXPath;
-
-import java.io.File;
-import java.util.Iterator;
-
import org.junit.Ignore;
import org.junit.Test;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.xmlunit.builder.DiffBuilder;
import org.xmlunit.builder.Input;
-import org.xmlunit.diff.ComparisonControllers;
-import org.xmlunit.diff.DefaultNodeMatcher;
-import org.xmlunit.diff.Diff;
-import org.xmlunit.diff.Difference;
-import org.xmlunit.diff.ElementSelectors;
+import org.xmlunit.diff.*;
import org.xmlunit.validation.Languages;
import org.xmlunit.validation.ValidationProblem;
import org.xmlunit.validation.ValidationResult;
import org.xmlunit.validation.Validator;
import org.xmlunit.xpath.JAXPXPathEngine;
+import java.io.File;
+import java.util.Iterator;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.*;
+import static org.xmlunit.matchers.CompareMatcher.isIdenticalTo;
+import static org.xmlunit.matchers.CompareMatcher.isSimilarTo;
+import static org.xmlunit.matchers.HasXPathMatcher.hasXPath;
+
public class XMLUnitTest {
@Test
public void givenWrongXml_whenValidateFailsAgainstXsd_thenCorrect() {
diff --git a/xmlunit2-tutorial/src/test/resources/control.xml b/xmlunit2/src/test/resources/control.xml
similarity index 100%
rename from xmlunit2-tutorial/src/test/resources/control.xml
rename to xmlunit2/src/test/resources/control.xml
diff --git a/xmlunit2-tutorial/src/test/resources/students.xml b/xmlunit2/src/test/resources/students.xml
similarity index 100%
rename from xmlunit2-tutorial/src/test/resources/students.xml
rename to xmlunit2/src/test/resources/students.xml
diff --git a/xmlunit2-tutorial/src/test/resources/students.xsd b/xmlunit2/src/test/resources/students.xsd
similarity index 100%
rename from xmlunit2-tutorial/src/test/resources/students.xsd
rename to xmlunit2/src/test/resources/students.xsd
diff --git a/xmlunit2-tutorial/src/test/resources/students_with_error.xml b/xmlunit2/src/test/resources/students_with_error.xml
similarity index 100%
rename from xmlunit2-tutorial/src/test/resources/students_with_error.xml
rename to xmlunit2/src/test/resources/students_with_error.xml
diff --git a/xmlunit2-tutorial/src/test/resources/teachers.xml b/xmlunit2/src/test/resources/teachers.xml
similarity index 100%
rename from xmlunit2-tutorial/src/test/resources/teachers.xml
rename to xmlunit2/src/test/resources/teachers.xml
diff --git a/xmlunit2-tutorial/src/test/resources/test.xml b/xmlunit2/src/test/resources/test.xml
similarity index 100%
rename from xmlunit2-tutorial/src/test/resources/test.xml
rename to xmlunit2/src/test/resources/test.xml