From acbd7ea6b2e8b5cfe534a01c3fe2388dd3bdc970 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sat, 15 Sep 2018 22:07:27 +0200 Subject: [PATCH 01/12] added link --- libraries-data/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-data/README.md b/libraries-data/README.md index 652ae0e04c..63ee5f9947 100644 --- a/libraries-data/README.md +++ b/libraries-data/README.md @@ -11,3 +11,4 @@ - [Apache Ignite with Spring Data](http://www.baeldung.com/apache-ignite-spring-data) - [Guide to JMapper](https://www.baeldung.com/jmapper) - [A Guide to Apache Crunch](https://www.baeldung.com/apache-crunch) +- [Building a Data Pipeline with Flink and Kafka](https://www.baeldung.com/kafka-flink-data-pipeline) From 68618ed5e03a2f24869d59067e15e2a7e26076f5 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sat, 15 Sep 2018 22:08:35 +0200 Subject: [PATCH 02/12] added link --- java-strings/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/java-strings/README.md b/java-strings/README.md index 233d986d98..8f0ab60a53 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -27,3 +27,4 @@ - [Compact Strings in Java 9](http://www.baeldung.com/java-9-compact-string) - [Java Check a String for Lowercase/Uppercase Letter, Special Character and Digit](https://www.baeldung.com/java-lowercase-uppercase-special-character-digit-regex) - [Convert java.util.Date to String](https://www.baeldung.com/java-util-date-to-string) +- [Get Substring from String in Java](https://www.baeldung.com/java-substring) From 69f149835bed8f569019829af163504ffbb232b0 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sun, 16 Sep 2018 22:23:43 +0200 Subject: [PATCH 03/12] added link --- hibernate5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/hibernate5/README.md b/hibernate5/README.md index 8f2f8eb469..e42229a152 100644 --- a/hibernate5/README.md +++ b/hibernate5/README.md @@ -14,3 +14,4 @@ - [Bootstrapping JPA Programmatically in Java](http://www.baeldung.com/java-bootstrap-jpa) - [Optimistic Locking in JPA](http://www.baeldung.com/jpa-optimistic-locking) - [Hibernate Entity Lifecycle](https://www.baeldung.com/hibernate-entity-lifecycle) +- [Mapping A Hibernate Query to a Custom Class](https://www.baeldung.com/hibernate-query-to-custom-class) From 7b1e4c8e759329d78fc7999691f4d684666378e6 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Sun, 16 Sep 2018 22:25:10 +0200 Subject: [PATCH 04/12] added link --- jersey/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/jersey/README.md b/jersey/README.md index 3121c560cf..89e93107f7 100644 --- a/jersey/README.md +++ b/jersey/README.md @@ -1,2 +1,3 @@ - [Jersey Filters and Interceptors](http://www.baeldung.com/jersey-filters-interceptors) - [Jersey MVC Support](https://www.baeldung.com/jersey-mvc) +- [Bean Validation in Jersey](https://www.baeldung.com/jersey-bean-validation) From 9280b9e81bd0e0ca2b3589e03ff3218f0db6f516 Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Mon, 17 Sep 2018 20:21:35 +0200 Subject: [PATCH 05/12] added link --- core-java-collections/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index f187141712..4502998c52 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -49,3 +49,4 @@ - [Collections.emptyList() vs. New List Instance](https://www.baeldung.com/java-collections-emptylist-new-list) - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) - [](https://www.baeldung.com/java-hashset-arraylist-contains-performance) +- [Differences Between Collection.clear() and Collection.removeAll()](https://www.baeldung.com/java-collection-clear-vs-removeall) From 63e856a44d6a3303b6aa0c0884d7ec7843a2d1cb Mon Sep 17 00:00:00 2001 From: Tom Hombergs Date: Thu, 4 Oct 2018 21:03:45 +0200 Subject: [PATCH 06/12] added README --- flyway-cdi-extension/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 flyway-cdi-extension/README.md diff --git a/flyway-cdi-extension/README.md b/flyway-cdi-extension/README.md new file mode 100644 index 0000000000..3e03d5aee8 --- /dev/null +++ b/flyway-cdi-extension/README.md @@ -0,0 +1,3 @@ +### Relevant articles + +- [CDI Portable Extension and Flyway](https://www.baeldung.com/cdi-portable-extension) From f046857975a53ba5169852ad6112d5711dfb192e Mon Sep 17 00:00:00 2001 From: Felipe Santiago Corro Date: Mon, 8 Oct 2018 03:36:38 -0300 Subject: [PATCH 07/12] BAEL-2237 Using Jackson to parse XML and return JSON (#5401) --- jackson/pom.xml | 2 +- .../com/baeldung/jackson/xmlToJson/Color.java | 5 ++ .../baeldung/jackson/xmlToJson/Flower.java | 42 ++++++++++++++ .../jackson/xmlToJson/XmlToJsonUnitTest.java | 56 +++++++++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 jackson/src/main/java/com/baeldung/jackson/xmlToJson/Color.java create mode 100644 jackson/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java create mode 100644 jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java diff --git a/jackson/pom.xml b/jackson/pom.xml index 9592e11961..e941ababc5 100644 --- a/jackson/pom.xml +++ b/jackson/pom.xml @@ -118,7 +118,7 @@ - 2.9.6 + 2.9.7 3.8 2.10 diff --git a/jackson/src/main/java/com/baeldung/jackson/xmlToJson/Color.java b/jackson/src/main/java/com/baeldung/jackson/xmlToJson/Color.java new file mode 100644 index 0000000000..19dabb30b0 --- /dev/null +++ b/jackson/src/main/java/com/baeldung/jackson/xmlToJson/Color.java @@ -0,0 +1,5 @@ +package com.baeldung.jackson.xmlToJson; + +public enum Color { + PINK, BLUE, YELLOW, RED; +} diff --git a/jackson/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java b/jackson/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java new file mode 100644 index 0000000000..0b1ee1b16a --- /dev/null +++ b/jackson/src/main/java/com/baeldung/jackson/xmlToJson/Flower.java @@ -0,0 +1,42 @@ +package com.baeldung.jackson.xmlToJson; + +public class Flower { + + private String name; + + private Color color; + + private Integer petals; + + public Flower() { } + + public Flower(String name, Color color, Integer petals) { + this.name = name; + this.color = color; + this.petals = petals; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Color getColor() { + return color; + } + + public void setColor(Color color) { + this.color = color; + } + + public Integer getPetals() { + return petals; + } + + public void setPetals(Integer petals) { + this.petals = petals; + } +} diff --git a/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java b/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java new file mode 100644 index 0000000000..295bb9d6e8 --- /dev/null +++ b/jackson/src/test/java/com/baeldung/jackson/xmlToJson/XmlToJsonUnitTest.java @@ -0,0 +1,56 @@ +package com.baeldung.jackson.xmlToJson; + + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.xml.XmlMapper; +import org.junit.Test; + +import static org.junit.Assert.*; + +import java.io.IOException; + +public class XmlToJsonUnitTest { + + @Test + public void givenAnXML_whenUseDataBidingToConvertToJSON_thenReturnDataOK() { + String flowerXML = "PoppyRED9"; + + try { + XmlMapper xmlMapper = new XmlMapper(); + Flower poppy = xmlMapper.readValue(flowerXML, Flower.class); + + assertEquals(poppy.getName(), "Poppy"); + assertEquals(poppy.getColor(), Color.RED); + assertEquals(poppy.getPetals(), new Integer(9)); + + ObjectMapper mapper = new ObjectMapper(); + String json = mapper.writeValueAsString(poppy); + + assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":9}"); + System.out.println(json); + } catch(IOException e) { + e.printStackTrace(); + } + } + + @Test + public void givenAnXML_whenUseATreeConvertToJSON_thenReturnDataOK() { + String flowerXML = "PoppyRED9"; + + try { + XmlMapper xmlMapper = new XmlMapper(); + JsonNode node = xmlMapper.readTree(flowerXML.getBytes()); + + ObjectMapper jsonMapper = new ObjectMapper(); + String json = jsonMapper.writeValueAsString(node); + + System.out.println(json); + + assertEquals(json, "{\"name\":\"Poppy\",\"color\":\"RED\",\"petals\":\"9\"}"); + } catch(IOException e) { + e.printStackTrace(); + } + } +} From 178c9435e973dfa573e1a208f1ca1ec4719a8753 Mon Sep 17 00:00:00 2001 From: moisko Date: Mon, 30 Jul 2018 10:30:46 +0300 Subject: [PATCH 08/12] BAEL2212: implement insertion sort in imperative and recursive way --- .../insertionsort/InsertionSort.java | 41 +++++++++++++++++++ .../insertionsort/InsertionSortUnitTest.java | 26 ++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 algorithms/src/main/java/com/baeldung/algorithms/insertionsort/InsertionSort.java create mode 100644 algorithms/src/test/java/algorithms/insertionsort/InsertionSortUnitTest.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/insertionsort/InsertionSort.java b/algorithms/src/main/java/com/baeldung/algorithms/insertionsort/InsertionSort.java new file mode 100644 index 0000000000..02dd485cf1 --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/insertionsort/InsertionSort.java @@ -0,0 +1,41 @@ +package com.baeldung.algorithms.insertionsort; + +public class InsertionSort { + + public static void insertionSortImperative(int[] input) { + for (int i = 1; i < input.length; i++) { + int key = input[i]; + int j = i - 1; + while (j >= 0 && input[j] > key) { + input[j + 1] = input[j]; + j = j - 1; + } + input[j + 1] = key; + } + } + + public static void insertionSortRecursive(int[] input) { + insertionSortRecursive(input, input.length); + } + + private static void insertionSortRecursive(int[] input, int i) { + // base case + if (i <= 1) { + return; + } + + // sort the first i - 1 elements of the array + insertionSortRecursive(input, i - 1); + + // then find the correct position of the element at position i + int key = input[i - 1]; + int j = i - 2; + // shifting the elements from their position by 1 + while (j >= 0 && input[j] > key) { + input[j + 1] = input[j]; + j = j - 1; + } + // inserting the key at the appropriate position + input[j + 1] = key; + } +} diff --git a/algorithms/src/test/java/algorithms/insertionsort/InsertionSortUnitTest.java b/algorithms/src/test/java/algorithms/insertionsort/InsertionSortUnitTest.java new file mode 100644 index 0000000000..a5d19cb41d --- /dev/null +++ b/algorithms/src/test/java/algorithms/insertionsort/InsertionSortUnitTest.java @@ -0,0 +1,26 @@ +package algorithms.insertionsort; + +import com.baeldung.algorithms.insertionsort.InsertionSort; +import org.junit.Test; + +import static org.junit.Assert.assertArrayEquals; + +public class InsertionSortUnitTest { + + @Test + public void givenUnsortedArray_whenInsertionSortImperatively_thenItIsSortedInAscendingOrder() { + int[] input = {6, 2, 3, 4, 5, 1}; + InsertionSort.insertionSortImperative(input); + int[] expected = {1, 2, 3, 4, 5, 6}; + assertArrayEquals("the two arrays are not equal", expected, input); + } + + @Test + public void givenUnsortedArray_whenInsertionSortRecursively_thenItIsSortedInAscendingOrder() { + // int[] input = {6, 4, 5, 2, 3, 1}; + int[] input = {6, 4}; + InsertionSort.insertionSortRecursive(input); + int[] expected = {1, 2, 3, 4, 5, 6}; + assertArrayEquals("the two arrays are not equal", expected, input); + } +} From 11dd36cb1a3b41da9b97720c71b4af27e8de56e0 Mon Sep 17 00:00:00 2001 From: Kumar Chandrakant Date: Mon, 8 Oct 2018 14:52:59 +0100 Subject: [PATCH 09/12] Adding files for the article BAEL-2257: Guide to OutputStream (#5386) --- .../baeldung/stream/OutputStreamExamples.java | 48 ++++++++++++ .../stream/OutputStreamExamplesTest.java | 76 +++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 core-java-io/src/main/java/com/baeldung/stream/OutputStreamExamples.java create mode 100644 core-java-io/src/test/java/com/baeldung/stream/OutputStreamExamplesTest.java diff --git a/core-java-io/src/main/java/com/baeldung/stream/OutputStreamExamples.java b/core-java-io/src/main/java/com/baeldung/stream/OutputStreamExamples.java new file mode 100644 index 0000000000..c7168c5b26 --- /dev/null +++ b/core-java-io/src/main/java/com/baeldung/stream/OutputStreamExamples.java @@ -0,0 +1,48 @@ +package com.baeldung.stream; + +import java.io.BufferedOutputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; + +public class OutputStreamExamples { + + public void fileOutputStreamByteSequence(String file, String data) throws IOException { + byte[] bytes = data.getBytes(); + try (OutputStream out = new FileOutputStream(file)) { + out.write(bytes); + } + } + + public void fileOutputStreamByteSubSequence(String file, String data) throws IOException { + byte[] bytes = data.getBytes(); + try (OutputStream out = new FileOutputStream(file)) { + out.write(bytes, 6, 5); + } + } + + public void fileOutputStreamByteSingle(String file, String data) throws IOException { + byte[] bytes = data.getBytes(); + try (OutputStream out = new FileOutputStream(file)) { + out.write(bytes[6]); + } + } + + public void bufferedOutputStream(String file, String... data) throws IOException { + try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { + for (String s : data) { + out.write(s.getBytes()); + out.write(" ".getBytes()); + } + } + } + + public void outputStreamWriter(String file, String data) throws IOException { + try (OutputStream out = new FileOutputStream(file); Writer writer = new OutputStreamWriter(out, "UTF-8")) { + writer.write(data); + } + } + +} diff --git a/core-java-io/src/test/java/com/baeldung/stream/OutputStreamExamplesTest.java b/core-java-io/src/test/java/com/baeldung/stream/OutputStreamExamplesTest.java new file mode 100644 index 0000000000..4ae1ce9aa7 --- /dev/null +++ b/core-java-io/src/test/java/com/baeldung/stream/OutputStreamExamplesTest.java @@ -0,0 +1,76 @@ +package com.baeldung.stream; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +public class OutputStreamExamplesTest { + + StringBuilder filePath = new StringBuilder(); + + @Before + public void init() { + filePath.append("src"); + filePath.append(File.separator); + filePath.append("test"); + filePath.append(File.separator); + filePath.append("resources"); + filePath.append(File.separator); + filePath.append("output_file.txt"); + } + + @Test + public void givenOutputStream_whenWriteSingleByteCalled_thenOutputCreated() throws IOException { + + final File file = new File(filePath.toString()); + OutputStreamExamples examples = new OutputStreamExamples(); + examples.fileOutputStreamByteSingle(filePath.toString(), "Hello World!"); + assertTrue(file.exists()); + file.delete(); + } + + @Test + public void givenOutputStream_whenWriteByteSequenceCalled_thenOutputCreated() throws IOException { + + final File file = new File(filePath.toString()); + OutputStreamExamples examples = new OutputStreamExamples(); + examples.fileOutputStreamByteSequence(filePath.toString(), "Hello World!"); + assertTrue(file.exists()); + file.delete(); + } + + @Test + public void givenOutputStream_whenWriteByteSubSequenceCalled_thenOutputCreated() throws IOException { + + final File file = new File(filePath.toString()); + OutputStreamExamples examples = new OutputStreamExamples(); + examples.fileOutputStreamByteSubSequence(filePath.toString(), "Hello World!"); + assertTrue(file.exists()); + file.delete(); + } + + @Test + public void givenBufferedOutputStream_whenCalled_thenOutputCreated() throws IOException { + + final File file = new File(filePath.toString()); + OutputStreamExamples examples = new OutputStreamExamples(); + examples.bufferedOutputStream(filePath.toString(), "Hello", "World!"); + assertTrue(file.exists()); + file.delete(); + } + + @Test + public void givenOutputStreamWriter_whenCalled_thenOutputCreated() throws IOException { + + final File file = new File(filePath.toString()); + OutputStreamExamples examples = new OutputStreamExamples(); + examples.outputStreamWriter(filePath.toString(), "Hello World!"); + assertTrue(file.exists()); + file.delete(); + } + +} From 37896ced0ea040b8c9111e2b21458ac88e9a6e8a Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Mon, 8 Oct 2018 23:09:44 +0300 Subject: [PATCH 10/12] remove diff-dates module --- .../com/baeldung/date/DateDiffUnitTest.java | 13 ++++ java-difference-date/README.md | 5 -- java-difference-date/pom.xml | 36 ----------- .../java/com/baeldung/DateDiffUnitTest.java | 61 ------------------- pom.xml | 2 - 5 files changed, 13 insertions(+), 104 deletions(-) delete mode 100644 java-difference-date/README.md delete mode 100644 java-difference-date/pom.xml delete mode 100644 java-difference-date/src/test/java/com/baeldung/DateDiffUnitTest.java diff --git a/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java b/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java index 545009a2a9..58d192bfdb 100644 --- a/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java +++ b/java-dates/src/test/java/com/baeldung/date/DateDiffUnitTest.java @@ -5,7 +5,9 @@ import org.junit.Test; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Duration; +import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.Period; import java.util.Date; import java.util.Locale; import java.util.TimeZone; @@ -26,6 +28,17 @@ public class DateDiffUnitTest { assertEquals(diff, 6); } + + @Test + public void givenTwoDatesInJava8_whenDifferentiating_thenWeGetSix() { + LocalDate now = LocalDate.now(); + LocalDate sixDaysBehind = now.minusDays(6); + + Period period = Period.between(now, sixDaysBehind); + int diff = period.getDays(); + + assertEquals(diff, 6); + } @Test public void givenTwoDateTimesInJava8_whenDifferentiating_thenWeGetSix() { diff --git a/java-difference-date/README.md b/java-difference-date/README.md deleted file mode 100644 index 2a024c27a2..0000000000 --- a/java-difference-date/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## Relevant articles: - -- [Period and Duration in Java](http://www.baeldung.com/java-period-duration) -- [Introduction to the Java 8 Date/Time API](http://www.baeldung.com/java-8-date-time-intro) -- [Migrating to the New Java 8 Date Time API](http://www.baeldung.com/migrating-to-java-8-date-time-api) \ No newline at end of file diff --git a/java-difference-date/pom.xml b/java-difference-date/pom.xml deleted file mode 100644 index 8c87afc0a2..0000000000 --- a/java-difference-date/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - com.baeldung - java-difference-date - 0.0.1-SNAPSHOT - jar - java-difference-date - Difference between two dates in java - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - joda-time - joda-time - ${joda-time.version} - - - com.darwinsys - hirondelle-date4j - ${hirondelle-date4j.version} - - - - - 2.9.9 - 1.5.1 - - - diff --git a/java-difference-date/src/test/java/com/baeldung/DateDiffUnitTest.java b/java-difference-date/src/test/java/com/baeldung/DateDiffUnitTest.java deleted file mode 100644 index 2c5323be6f..0000000000 --- a/java-difference-date/src/test/java/com/baeldung/DateDiffUnitTest.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.baeldung; - -import org.joda.time.DateTime; -import org.junit.Test; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.time.Duration; -import java.time.ZonedDateTime; -import java.util.Date; -import java.util.Locale; -import java.util.TimeZone; -import java.util.concurrent.TimeUnit; - -import static org.junit.Assert.assertEquals; - -public class DateDiffUnitTest { - @Test - public void givenTwoDatesBeforeJava8_whenDifferentiating_thenWeGetSix() throws ParseException { - SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH); - Date firstDate = sdf.parse("06/24/2017"); - Date secondDate = sdf.parse("06/30/2017"); - - long diffInMillies = Math.abs(secondDate.getTime() - firstDate.getTime()); - long diff = TimeUnit.DAYS.convert(diffInMillies, TimeUnit.MILLISECONDS); - - assertEquals(diff, 6); - } - - @Test - public void givenTwoDatesInJava8_whenDifferentiating_thenWeGetSix() { - ZonedDateTime now = ZonedDateTime.now(); - ZonedDateTime sixDaysBehind = now.minusDays(6); - - Duration duration = Duration.between(now, sixDaysBehind); - long diff = Math.abs(duration.toDays()); - - assertEquals(diff, 6); - } - - @Test - public void givenTwoDatesInJodaTime_whenDifferentiating_thenWeGetSix() { - DateTime now = DateTime.now(); - DateTime sixDaysBehind = now.minusDays(6); - - org.joda.time.Duration duration = new org.joda.time.Duration(now, sixDaysBehind); - long diff = Math.abs(duration.getStandardDays()); - - assertEquals(diff, 6); - } - - @Test - public void givenTwoDatesInDate4j_whenDifferentiating_thenWeGetSix() { - hirondelle.date4j.DateTime now = hirondelle.date4j.DateTime.now(TimeZone.getDefault()); - hirondelle.date4j.DateTime sixDaysBehind = now.minusDays(6); - - long diff = Math.abs(now.numDaysFrom(sixDaysBehind)); - - assertEquals(diff, 6); - } -} \ No newline at end of file diff --git a/pom.xml b/pom.xml index ef34881cef..569b6a62be 100644 --- a/pom.xml +++ b/pom.xml @@ -665,7 +665,6 @@ dubbo flyway - java-difference-date jni jooby @@ -1138,7 +1137,6 @@ dubbo flyway - java-difference-date jni jooby From 6d67e16b3978815e658a0c20d9ea6742e0ad9f73 Mon Sep 17 00:00:00 2001 From: Alejandro Gervasio Date: Mon, 8 Oct 2018 23:37:37 -0300 Subject: [PATCH 11/12] BAEL-2253 - Difference Between @NotNull, @NotEmpty and @NotBlank Constraints in Bean Validation (#5399) * Initial Commit * Update UserNotBlankUnitTest.java * Update UserNotEmptyUnitTest.java * Update UserNotNullUnitTest.java * Update pom.xml * Update pom.xml * Update pom.xml --- javaxval/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/javaxval/pom.xml b/javaxval/pom.xml index 63cb4c1d1d..86a7e6955b 100644 --- a/javaxval/pom.xml +++ b/javaxval/pom.xml @@ -63,11 +63,11 @@ 2.0.1.Final - 6.0.7.Final + 6.0.13.Final 3.0.0 - 2.2.6 + 3.0.0 5.0.2.RELEASE 4.12 3.11.1 - \ No newline at end of file + From ed2a28585ce6101783fd802ded7aafce7651b7a9 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Tue, 9 Oct 2018 13:10:13 +0300 Subject: [PATCH 12/12] fix unit test --- .../algorithms/insertionsort/InsertionSortUnitTest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) rename algorithms/src/test/java/{ => com/baeldung}/algorithms/insertionsort/InsertionSortUnitTest.java (66%) diff --git a/algorithms/src/test/java/algorithms/insertionsort/InsertionSortUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/insertionsort/InsertionSortUnitTest.java similarity index 66% rename from algorithms/src/test/java/algorithms/insertionsort/InsertionSortUnitTest.java rename to algorithms/src/test/java/com/baeldung/algorithms/insertionsort/InsertionSortUnitTest.java index a5d19cb41d..b3d7e8c534 100644 --- a/algorithms/src/test/java/algorithms/insertionsort/InsertionSortUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/insertionsort/InsertionSortUnitTest.java @@ -1,4 +1,4 @@ -package algorithms.insertionsort; +package com.baeldung.algorithms.insertionsort; import com.baeldung.algorithms.insertionsort.InsertionSort; import org.junit.Test; @@ -8,7 +8,7 @@ import static org.junit.Assert.assertArrayEquals; public class InsertionSortUnitTest { @Test - public void givenUnsortedArray_whenInsertionSortImperatively_thenItIsSortedInAscendingOrder() { + public void givenUnsortedArray_whenInsertionSortImperative_thenSortedAsc() { int[] input = {6, 2, 3, 4, 5, 1}; InsertionSort.insertionSortImperative(input); int[] expected = {1, 2, 3, 4, 5, 6}; @@ -16,9 +16,8 @@ public class InsertionSortUnitTest { } @Test - public void givenUnsortedArray_whenInsertionSortRecursively_thenItIsSortedInAscendingOrder() { - // int[] input = {6, 4, 5, 2, 3, 1}; - int[] input = {6, 4}; + public void givenUnsortedArray_whenInsertionSortRecursive_thenSortedAsc() { + int[] input = {6, 4, 5, 2, 3, 1}; InsertionSort.insertionSortRecursive(input); int[] expected = {1, 2, 3, 4, 5, 6}; assertArrayEquals("the two arrays are not equal", expected, input);