From cf6fab0d76b8c112f11f0d6c6cb7f467c58a9d3c Mon Sep 17 00:00:00 2001 From: catalin-burcea <burcea.iulian.catalin@gmail.com> Date: Tue, 10 Dec 2019 14:57:11 +0200 Subject: [PATCH] [BAEL-19882] - Move articles out of core-kotlin part1 --- core-kotlin-2/README.md | 2 - core-kotlin-io/.gitignore | 11 --- core-kotlin-io/pom.xml | 97 ------------------- core-kotlin-modules/README.md | 5 + .../core-kotlin-annotations/README.md | 8 ++ .../core-kotlin-annotations/pom.xml | 41 ++++++++ .../com/baeldung/annotations/Annotations.kt | 0 .../kotlin/com/baeldung/annotations/Item.kt | 0 .../kotlin/com/baeldung/annotations/Main.kt | 0 .../com/baeldung/annotations/Validator.kt | 0 .../com/baeldung/jvmannotations/Document.kt | 0 .../baeldung/jvmannotations/HtmlDocument.java | 0 .../com/baeldung/jvmannotations/Message.kt | 0 .../jvmannotations/MessageConverter.kt | 0 .../baeldung/jvmannotations/TextDocument.kt | 0 .../baeldung/jvmannotations/XmlDocument.kt | 0 .../com/baeldung/jvmfield}/JvmSample.kt | 2 +- .../baeldung/annotations/ValidationTest.kt | 0 .../baeldung/jvmannotations}/DocumentTest.kt | 0 .../com/baeldung/jvmfield}/JvmSampleTest.kt | 2 +- .../core-kotlin-io}/README.md | 4 +- core-kotlin-modules/core-kotlin-io/pom.xml | 54 +++++++++++ .../com/baeldung/filesystem/FileReader.kt | 0 .../com/baeldung/filesystem/FileWriter.kt | 0 .../inputstream/InputStreamExtension.kt | 0 .../com/baeldung/console/ConsoleIOUnitTest.kt | 0 .../com/baeldung/filesystem/FileReaderTest.kt | 0 .../com/baeldung/filesystem/FileWriterTest.kt | 0 .../inputstream/InputStreamToStringTest.kt | 4 +- .../src/test/resources/Kotlin.in | 0 .../src/test/resources/Kotlin.out | 0 .../src/test/resources/inputstream2string.txt | 0 .../org.mockito.plugins.MockMaker | 0 .../core-kotlin-strings/README.md | 9 ++ .../core-kotlin-strings/pom.xml | 24 +++++ .../com/baeldung/stringtemplates/Templates.kt | 0 .../randomstring}/RandomStringUnitTest.kt | 2 + .../stringcomparison/StringComparisonTest.kt | 2 +- .../StringConcatenationTest.kt | 2 +- core-kotlin-modules/pom.xml | 56 +++++++++++ core-kotlin/README.md | 6 -- pom.xml | 3 +- 42 files changed, 210 insertions(+), 124 deletions(-) delete mode 100644 core-kotlin-io/.gitignore delete mode 100644 core-kotlin-io/pom.xml create mode 100644 core-kotlin-modules/README.md create mode 100644 core-kotlin-modules/core-kotlin-annotations/README.md create mode 100644 core-kotlin-modules/core-kotlin-annotations/pom.xml rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/annotations/Annotations.kt (100%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/annotations/Item.kt (100%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/annotations/Main.kt (100%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/annotations/Validator.kt (100%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/jvmannotations/Document.kt (100%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/jvmannotations/HtmlDocument.java (100%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/jvmannotations/Message.kt (100%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/jvmannotations/MessageConverter.kt (100%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt (100%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt (100%) rename {core-kotlin/src/main/kotlin/com/baeldung/kotlin => core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmfield}/JvmSample.kt (85%) rename {core-kotlin-2 => core-kotlin-modules/core-kotlin-annotations}/src/test/kotlin/com/baeldung/annotations/ValidationTest.kt (100%) rename {core-kotlin-2/src/test/kotlin/com/baeldung/range => core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmannotations}/DocumentTest.kt (100%) rename {core-kotlin/src/test/kotlin/com/baeldung/kotlin => core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmfield}/JvmSampleTest.kt (94%) rename {core-kotlin-io => core-kotlin-modules/core-kotlin-io}/README.md (62%) create mode 100644 core-kotlin-modules/core-kotlin-io/pom.xml rename {core-kotlin => core-kotlin-modules/core-kotlin-io}/src/main/kotlin/com/baeldung/filesystem/FileReader.kt (100%) rename {core-kotlin => core-kotlin-modules/core-kotlin-io}/src/main/kotlin/com/baeldung/filesystem/FileWriter.kt (100%) rename {core-kotlin-io => core-kotlin-modules/core-kotlin-io}/src/main/kotlin/com/baeldung/inputstream/InputStreamExtension.kt (100%) rename {core-kotlin-io => core-kotlin-modules/core-kotlin-io}/src/test/kotlin/com/baeldung/console/ConsoleIOUnitTest.kt (100%) rename {core-kotlin => core-kotlin-modules/core-kotlin-io}/src/test/kotlin/com/baeldung/filesystem/FileReaderTest.kt (100%) rename {core-kotlin => core-kotlin-modules/core-kotlin-io}/src/test/kotlin/com/baeldung/filesystem/FileWriterTest.kt (100%) rename {core-kotlin-io => core-kotlin-modules/core-kotlin-io}/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt (99%) rename {core-kotlin => core-kotlin-modules/core-kotlin-io}/src/test/resources/Kotlin.in (100%) rename {core-kotlin => core-kotlin-modules/core-kotlin-io}/src/test/resources/Kotlin.out (100%) rename {core-kotlin-io => core-kotlin-modules/core-kotlin-io}/src/test/resources/inputstream2string.txt (100%) rename {core-kotlin-io => core-kotlin-modules/core-kotlin-io}/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker (100%) create mode 100644 core-kotlin-modules/core-kotlin-strings/README.md create mode 100644 core-kotlin-modules/core-kotlin-strings/pom.xml rename {core-kotlin => core-kotlin-modules/core-kotlin-strings}/src/main/kotlin/com/baeldung/stringtemplates/Templates.kt (100%) rename {core-kotlin/src/test/kotlin/com/baeldung/random => core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/randomstring}/RandomStringUnitTest.kt (98%) rename {core-kotlin-2/src/test/kotlin => core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung}/stringcomparison/StringComparisonTest.kt (97%) rename {core-kotlin/src/test/kotlin/com/baeldung/kotlin => core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringconcatenation}/StringConcatenationTest.kt (96%) create mode 100644 core-kotlin-modules/pom.xml diff --git a/core-kotlin-2/README.md b/core-kotlin-2/README.md index 06dda396d9..5a443c1831 100644 --- a/core-kotlin-2/README.md +++ b/core-kotlin-2/README.md @@ -10,7 +10,5 @@ This module contains articles about core Kotlin. - [Kotlin Scope Functions](https://www.baeldung.com/kotlin-scope-functions) - [Kotlin Annotations](https://www.baeldung.com/kotlin-annotations) - [Split a List into Parts in Kotlin](https://www.baeldung.com/kotlin-split-list-into-parts) -- [String Comparison in Kotlin](https://www.baeldung.com/kotlin-string-comparison) -- [Guide to JVM Platform Annotations in Kotlin](https://www.baeldung.com/kotlin-jvm-annotations) - [Finding an Element in a List Using Kotlin](https://www.baeldung.com/kotlin-finding-element-in-list) - More articles: [[<-- prev]](/core-kotlin) diff --git a/core-kotlin-io/.gitignore b/core-kotlin-io/.gitignore deleted file mode 100644 index f521947850..0000000000 --- a/core-kotlin-io/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -/bin/ - -#ignore gradle -.gradle/ - - -#ignore build and generated files -build/ -node/ -target/ -out/ diff --git a/core-kotlin-io/pom.xml b/core-kotlin-io/pom.xml deleted file mode 100644 index 78b36626d6..0000000000 --- a/core-kotlin-io/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>core-kotlin-io</artifactId> - <name>core-kotlin-io</name> - <packaging>jar</packaging> - - <parent> - <groupId>com.baeldung</groupId> - <artifactId>parent-kotlin</artifactId> - <version>1.0.0-SNAPSHOT</version> - <relativePath>../parent-kotlin</relativePath> - </parent> - - <dependencies> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-stdlib-jdk8</artifactId> - <version>${kotlin.version}</version> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter</artifactId> - <version>${junit-jupiter.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>${mockito.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>net.bytebuddy</groupId> - <artifactId>byte-buddy</artifactId> - <version>${byte-buddy.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-test</artifactId> - <version>${kotlin.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-test-junit5</artifactId> - <version>${kotlin.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.jetbrains.kotlin</groupId> - <artifactId>kotlin-maven-plugin</artifactId> - <version>${kotlin.version}</version> - <executions> - <execution> - <id>compile</id> - <phase>compile</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - <execution> - <id>test-compile</id> - <phase>test-compile</phase> - <goals> - <goal>test-compile</goal> - </goals> - </execution> - </executions> - <configuration> - <jvmTarget>1.8</jvmTarget> - </configuration> - </plugin> - </plugins> - </build> - - <properties> - <kotlin.version>1.3.30</kotlin.version> - <junit-jupiter.version>5.4.2</junit-jupiter.version> - <mockito.version>2.27.0</mockito.version> - <byte-buddy.version>1.9.12</byte-buddy.version> - <assertj.version>3.10.0</assertj.version> - </properties> - -</project> diff --git a/core-kotlin-modules/README.md b/core-kotlin-modules/README.md new file mode 100644 index 0000000000..974db9378a --- /dev/null +++ b/core-kotlin-modules/README.md @@ -0,0 +1,5 @@ +## Core Kotlin + +This module contains articles about core Kotlin. + + diff --git a/core-kotlin-modules/core-kotlin-annotations/README.md b/core-kotlin-modules/core-kotlin-annotations/README.md new file mode 100644 index 0000000000..787b67be11 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-annotations/README.md @@ -0,0 +1,8 @@ +## Core Kotlin Annotations + +This module contains articles about core Kotlin annotations. + +### Relevant articles: +- [Kotlin Annotations](https://www.baeldung.com/kotlin-annotations) +- [Guide to Kotlin @JvmField](https://www.baeldung.com/kotlin-jvm-field-annotation) +- [Guide to JVM Platform Annotations in Kotlin](https://www.baeldung.com/kotlin-jvm-annotations) diff --git a/core-kotlin-modules/core-kotlin-annotations/pom.xml b/core-kotlin-modules/core-kotlin-annotations/pom.xml new file mode 100644 index 0000000000..77670be151 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-annotations/pom.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>core-kotlin-annotations</artifactId> + <name>core-kotlin-annotations</name> + <packaging>jar</packaging> + + <parent> + <groupId>com.baeldung.core-kotlin-modules</groupId> + <artifactId>core-kotlin-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + <version>${kotlin.version}</version> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test</artifactId> + <version>${kotlin.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <properties> + <kotlin.version>1.3.30</kotlin.version> + <assertj.version>3.10.0</assertj.version> + </properties> + +</project> \ No newline at end of file diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Annotations.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Annotations.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Annotations.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Annotations.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Item.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Item.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Item.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Item.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Main.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Main.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Main.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Main.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Validator.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Validator.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/annotations/Validator.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/annotations/Validator.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Document.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/Document.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Document.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/Document.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/HtmlDocument.java b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/HtmlDocument.java similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/HtmlDocument.java rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/HtmlDocument.java diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Message.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/Message.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/Message.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/Message.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/MessageConverter.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/MessageConverter.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/MessageConverter.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/MessageConverter.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/TextDocument.kt diff --git a/core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt similarity index 100% rename from core-kotlin-2/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmannotations/XmlDocument.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/JvmSample.kt b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmfield/JvmSample.kt similarity index 85% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/JvmSample.kt rename to core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmfield/JvmSample.kt index 610d5282b2..e60894ba88 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/JvmSample.kt +++ b/core-kotlin-modules/core-kotlin-annotations/src/main/kotlin/com/baeldung/jvmfield/JvmSample.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.jvmfield class JvmSample(text:String) { @JvmField diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/annotations/ValidationTest.kt b/core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/annotations/ValidationTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/annotations/ValidationTest.kt rename to core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/annotations/ValidationTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/range/DocumentTest.kt b/core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmannotations/DocumentTest.kt similarity index 100% rename from core-kotlin-2/src/test/kotlin/com/baeldung/range/DocumentTest.kt rename to core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmannotations/DocumentTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/JvmSampleTest.kt b/core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmfield/JvmSampleTest.kt similarity index 94% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/JvmSampleTest.kt rename to core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmfield/JvmSampleTest.kt index abe6edec92..769c0311c4 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/JvmSampleTest.kt +++ b/core-kotlin-modules/core-kotlin-annotations/src/test/kotlin/com/baeldung/jvmfield/JvmSampleTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.jvmfield import org.junit.Before import org.junit.Test diff --git a/core-kotlin-io/README.md b/core-kotlin-modules/core-kotlin-io/README.md similarity index 62% rename from core-kotlin-io/README.md rename to core-kotlin-modules/core-kotlin-io/README.md index ad4c503895..89f9534d4b 100644 --- a/core-kotlin-io/README.md +++ b/core-kotlin-modules/core-kotlin-io/README.md @@ -3,7 +3,7 @@ This module contains articles about core Kotlin I/O. ### Relevant articles: - - [InputStream to String in Kotlin](https://www.baeldung.com/kotlin-inputstream-to-string) - [Console I/O in Kotlin](https://www.baeldung.com/kotlin-console-io) - +- [Reading from a File in Kotlin](https://www.baeldung.com/kotlin-read-file) +- [Writing to a File in Kotlin](https://www.baeldung.com/kotlin-write-file) diff --git a/core-kotlin-modules/core-kotlin-io/pom.xml b/core-kotlin-modules/core-kotlin-io/pom.xml new file mode 100644 index 0000000000..9443cd0d5b --- /dev/null +++ b/core-kotlin-modules/core-kotlin-io/pom.xml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>core-kotlin-io</artifactId> + <name>core-kotlin-io</name> + <packaging>jar</packaging> + + <parent> + <groupId>com.baeldung.core-kotlin-modules</groupId> + <artifactId>core-kotlin-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-stdlib-jdk8</artifactId> + <version>${kotlin.version}</version> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <version>${junit-jupiter.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>${mockito.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-test</artifactId> + <version>${kotlin.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <properties> + <junit-jupiter.version>5.4.2</junit-jupiter.version> + <mockito.version>2.27.0</mockito.version> + <assertj.version>3.10.0</assertj.version> + </properties> + +</project> \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/filesystem/FileReader.kt b/core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/filesystem/FileReader.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/filesystem/FileReader.kt rename to core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/filesystem/FileReader.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/filesystem/FileWriter.kt b/core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/filesystem/FileWriter.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/filesystem/FileWriter.kt rename to core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/filesystem/FileWriter.kt diff --git a/core-kotlin-io/src/main/kotlin/com/baeldung/inputstream/InputStreamExtension.kt b/core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/inputstream/InputStreamExtension.kt similarity index 100% rename from core-kotlin-io/src/main/kotlin/com/baeldung/inputstream/InputStreamExtension.kt rename to core-kotlin-modules/core-kotlin-io/src/main/kotlin/com/baeldung/inputstream/InputStreamExtension.kt diff --git a/core-kotlin-io/src/test/kotlin/com/baeldung/console/ConsoleIOUnitTest.kt b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/console/ConsoleIOUnitTest.kt similarity index 100% rename from core-kotlin-io/src/test/kotlin/com/baeldung/console/ConsoleIOUnitTest.kt rename to core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/console/ConsoleIOUnitTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filesystem/FileReaderTest.kt b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/filesystem/FileReaderTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filesystem/FileReaderTest.kt rename to core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/filesystem/FileReaderTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filesystem/FileWriterTest.kt b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/filesystem/FileWriterTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filesystem/FileWriterTest.kt rename to core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/filesystem/FileWriterTest.kt diff --git a/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt similarity index 99% rename from core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt rename to core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt index d10d23bef0..a0eb26b762 100644 --- a/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt +++ b/core-kotlin-modules/core-kotlin-io/src/test/kotlin/com/baeldung/inputstream/InputStreamToStringTest.kt @@ -7,6 +7,7 @@ import java.io.File import kotlin.test.assertEquals class InputStreamToStringTest { + private val fileName = "src/test/resources/inputstream2string.txt" private val endOfLine = System.lineSeparator() private val fileFullContent = "Computer programming can be a hassle$endOfLine" + @@ -19,6 +20,7 @@ class InputStreamToStringTest { val content = inputStream.bufferedReader().use(BufferedReader::readText) assertEquals(fileFullContent, content) } + @Test fun whenReadFileWithBufferedReaderReadText_thenFullFileContentIsReadAsString() { val file = File(fileName) @@ -32,6 +34,7 @@ class InputStreamToStringTest { } assertEquals(fileFullContent, content) } + @Test fun whenReadFileWithBufferedReaderManually_thenFullFileContentIsReadAsString() { val file = File(fileName) @@ -67,6 +70,5 @@ class InputStreamToStringTest { assertEquals(fileFullContent, content) } - } diff --git a/core-kotlin/src/test/resources/Kotlin.in b/core-kotlin-modules/core-kotlin-io/src/test/resources/Kotlin.in similarity index 100% rename from core-kotlin/src/test/resources/Kotlin.in rename to core-kotlin-modules/core-kotlin-io/src/test/resources/Kotlin.in diff --git a/core-kotlin/src/test/resources/Kotlin.out b/core-kotlin-modules/core-kotlin-io/src/test/resources/Kotlin.out similarity index 100% rename from core-kotlin/src/test/resources/Kotlin.out rename to core-kotlin-modules/core-kotlin-io/src/test/resources/Kotlin.out diff --git a/core-kotlin-io/src/test/resources/inputstream2string.txt b/core-kotlin-modules/core-kotlin-io/src/test/resources/inputstream2string.txt similarity index 100% rename from core-kotlin-io/src/test/resources/inputstream2string.txt rename to core-kotlin-modules/core-kotlin-io/src/test/resources/inputstream2string.txt diff --git a/core-kotlin-io/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/core-kotlin-modules/core-kotlin-io/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker similarity index 100% rename from core-kotlin-io/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker rename to core-kotlin-modules/core-kotlin-io/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker diff --git a/core-kotlin-modules/core-kotlin-strings/README.md b/core-kotlin-modules/core-kotlin-strings/README.md new file mode 100644 index 0000000000..0e3d8ea57f --- /dev/null +++ b/core-kotlin-modules/core-kotlin-strings/README.md @@ -0,0 +1,9 @@ +## Core Kotlin Strings + +This module contains articles about core Kotlin strings. + +### Relevant articles: +- [Generate a Random Alphanumeric String in Kotlin](https://www.baeldung.com/kotlin-random-alphanumeric-string) +- [String Comparison in Kotlin](https://www.baeldung.com/kotlin-string-comparison) +- [Concatenate Strings in Kotlin](https://www.baeldung.com/kotlin-concatenate-strings) +- [Kotlin String Templates](https://www.baeldung.com/kotlin-string-template) diff --git a/core-kotlin-modules/core-kotlin-strings/pom.xml b/core-kotlin-modules/core-kotlin-strings/pom.xml new file mode 100644 index 0000000000..fb2998e9e1 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-strings/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>core-kotlin-strings</artifactId> + <name>core-kotlin-strings</name> + <packaging>jar</packaging> + + <parent> + <groupId>com.baeldung.core-kotlin-modules</groupId> + <artifactId>core-kotlin-modules</artifactId> + <version>1.0.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${commons-lang3.version}</version> + </dependency> + </dependencies> + +</project> \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/stringtemplates/Templates.kt b/core-kotlin-modules/core-kotlin-strings/src/main/kotlin/com/baeldung/stringtemplates/Templates.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/stringtemplates/Templates.kt rename to core-kotlin-modules/core-kotlin-strings/src/main/kotlin/com/baeldung/stringtemplates/Templates.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/randomstring/RandomStringUnitTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt rename to core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/randomstring/RandomStringUnitTest.kt index 62e8dfe720..5b84d1f67d 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/randomstring/RandomStringUnitTest.kt @@ -1,3 +1,5 @@ +package com.baeldung.randomstring + import org.apache.commons.lang3.RandomStringUtils import org.junit.Before import org.junit.jupiter.api.BeforeAll diff --git a/core-kotlin-2/src/test/kotlin/stringcomparison/StringComparisonTest.kt b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringcomparison/StringComparisonTest.kt similarity index 97% rename from core-kotlin-2/src/test/kotlin/stringcomparison/StringComparisonTest.kt rename to core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringcomparison/StringComparisonTest.kt index 45a8dd7e04..9528f62df5 100644 --- a/core-kotlin-2/src/test/kotlin/stringcomparison/StringComparisonTest.kt +++ b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringcomparison/StringComparisonTest.kt @@ -1,4 +1,4 @@ -package stringcomparison +package com.baeldung.stringcomparison import org.junit.Test import kotlin.test.assertFalse diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/StringConcatenationTest.kt b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringconcatenation/StringConcatenationTest.kt similarity index 96% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/StringConcatenationTest.kt rename to core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringconcatenation/StringConcatenationTest.kt index 9c371614a4..9ac011f7d2 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/StringConcatenationTest.kt +++ b/core-kotlin-modules/core-kotlin-strings/src/test/kotlin/com/baeldung/stringconcatenation/StringConcatenationTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.stringconcatenation import org.junit.Test import kotlin.test.assertEquals diff --git a/core-kotlin-modules/pom.xml b/core-kotlin-modules/pom.xml new file mode 100644 index 0000000000..747e8b69de --- /dev/null +++ b/core-kotlin-modules/pom.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>com.baeldung.core-kotlin-modules</groupId> + <artifactId>core-kotlin-modules</artifactId> + <name>core-kotlin-modules</name> + <packaging>pom</packaging> + + <parent> + <groupId>com.baeldung</groupId> + <artifactId>parent-kotlin</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../parent-kotlin</relativePath> + </parent> + + <modules> + <module>core-kotlin-annotations</module> + <module>core-kotlin-io</module> + <module>core-kotlin-strings</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>org.jetbrains.kotlin</groupId> + <artifactId>kotlin-maven-plugin</artifactId> + <version>${kotlin.version}</version> + <executions> + <execution> + <id>compile</id> + <phase>compile</phase> + <goals> + <goal>compile</goal> + </goals> + </execution> + <execution> + <id>test-compile</id> + <phase>test-compile</phase> + <goals> + <goal>test-compile</goal> + </goals> + </execution> + </executions> + <configuration> + <jvmTarget>1.8</jvmTarget> + </configuration> + </plugin> + </plugins> + </build> + + <properties> + <kotlin.version>1.3.30</kotlin.version> + </properties> + +</project> diff --git a/core-kotlin/README.md b/core-kotlin/README.md index bdff95d36d..f75a4e764c 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -24,12 +24,8 @@ This module contains articles about core Kotlin. - [Try-with-resources in Kotlin](https://www.baeldung.com/kotlin-try-with-resources) - [Regular Expressions in Kotlin](https://www.baeldung.com/kotlin-regular-expressions) - [Objects in Kotlin](https://www.baeldung.com/kotlin-objects) -- [Reading from a File in Kotlin](https://www.baeldung.com/kotlin-read-file) -- [Guide to Kotlin @JvmField](https://www.baeldung.com/kotlin-jvm-field-annotation) - [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) -- [Writing to a File in Kotlin](https://www.baeldung.com/kotlin-write-file) - [Lambda Expressions in Kotlin](https://www.baeldung.com/kotlin-lambda-expressions) -- [Kotlin String Templates](https://www.baeldung.com/kotlin-string-template) - [Working with Enums in Kotlin](https://www.baeldung.com/kotlin-enum) - [Create a Java and Kotlin Project with Maven](https://www.baeldung.com/kotlin-maven-java-project) - [Reflection with Kotlin](https://www.baeldung.com/kotlin-reflection) @@ -41,7 +37,6 @@ This module contains articles about core Kotlin. - [Fuel HTTP Library with Kotlin](https://www.baeldung.com/kotlin-fuel) - [Introduction to Kovenant Library for Kotlin](https://www.baeldung.com/kotlin-kovenant) - [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class) -- [Concatenate Strings in Kotlin](https://www.baeldung.com/kotlin-concatenate-strings) - [Kotlin return, break, continue Keywords](https://www.baeldung.com/kotlin-return-break-continue) - [Mapping of Data Objects in Kotlin](https://www.baeldung.com/kotlin-data-objects) - [Initializing Arrays in Kotlin](https://www.baeldung.com/kotlin-initialize-array) @@ -50,7 +45,6 @@ This module contains articles about core Kotlin. - [Guide to Sorting in Kotlin](https://www.baeldung.com/kotlin-sort) - [Dependency Injection for Kotlin with Injekt](https://www.baeldung.com/kotlin-dependency-injection-with-injekt) - [Implementing a Binary Tree in Kotlin](https://www.baeldung.com/kotlin-binary-tree) -- [Generate a Random Alphanumeric String in Kotlin](https://www.baeldung.com/kotlin-random-alphanumeric-string) - [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) - [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading) - [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes) diff --git a/pom.xml b/pom.xml index db7ec25a5c..a9d66d0546 100644 --- a/pom.xml +++ b/pom.xml @@ -454,6 +454,7 @@ <module>core-java-modules/core-java</module> <module>core-java-modules/core-java-jar</module> <module>core-java-modules/core-java-jvm</module> + <module>core-kotlin-modules</module> <module>core-scala</module> <module>couchbase</module> <module>custom-pmd</module> @@ -932,7 +933,6 @@ <module>core-java-modules/core-java-concurrency-advanced-3</module> <module>core-kotlin</module> <!-- long running? --> <module>core-kotlin-2</module> - <module>core-kotlin-io</module> <module>jenkins/plugins</module> <module>jhipster</module> @@ -1094,6 +1094,7 @@ <module>core-java-modules/core-java-string-algorithms-2</module> <module>core-java-modules/core-java-string-apis</module> <module>core-java-modules/core-java-strings</module> + <module>core-kotlin-modules</module> <module>core-scala</module> <module>couchbase</module> <module>custom-pmd</module>