Merge pull request #8345 from catalin-burcea/BAEL-19882

[BAEL-19882] - Move articles out of core-kotlin part1
This commit is contained in:
Josh Cummings 2019-12-13 13:33:17 -07:00 committed by GitHub
commit 0084b8afec
42 changed files with 210 additions and 124 deletions

View File

@ -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)

View File

@ -1,11 +0,0 @@
/bin/
#ignore gradle
.gradle/
#ignore build and generated files
build/
node/
target/
out/

View File

@ -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>

View File

@ -0,0 +1,5 @@
## Core Kotlin
This module contains articles about core Kotlin.

View File

@ -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)

View File

@ -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>

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.jvmfield
class JvmSample(text:String) {
@JvmField

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.jvmfield
import org.junit.Before
import org.junit.Test

View File

@ -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)

View File

@ -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>

View File

@ -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)
}
}

View File

@ -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)

View File

@ -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>

View File

@ -1,3 +1,5 @@
package com.baeldung.randomstring
import org.apache.commons.lang3.RandomStringUtils
import org.junit.Before
import org.junit.jupiter.api.BeforeAll

View File

@ -1,4 +1,4 @@
package stringcomparison
package com.baeldung.stringcomparison
import org.junit.Test
import kotlin.test.assertFalse

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.stringconcatenation
import org.junit.Test
import kotlin.test.assertEquals

View File

@ -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>

View File

@ -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)

View File

@ -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>