[BAEL-19886] - moved related articles to the new core-kotlin-modules/core-kotlin module

This commit is contained in:
catalin-burcea 2020-01-03 18:33:14 +02:00
parent 14b011572e
commit b6fa15fcf1
42 changed files with 106 additions and 76 deletions

View File

@ -4,11 +4,5 @@ This module contains articles about core Kotlin.
### Relevant articles:
- [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)
- [Kotlin Ternary Conditional Operator](https://www.baeldung.com/kotlin-ternary-conditional-operator)
- More articles: [[<-- prev]](/core-kotlin)

View File

@ -0,0 +1,15 @@
## Core Kotlin
This module contains articles about Kotlin core features.
### Relevant articles:
- [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin)
- [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability)
- [Get a Random Number in Kotlin](https://www.baeldung.com/kotlin-random-number)
- [Create a Java and Kotlin Project with Maven](https://www.baeldung.com/kotlin-maven-java-project)
- [Guide to Sorting in Kotlin](https://www.baeldung.com/kotlin-sort)
- [Creational Design Patterns in Kotlin: Builder](https://www.baeldung.com/kotlin-builder-pattern)
- [Kotlin Scope Functions](https://www.baeldung.com/kotlin-scope-functions)
- [Implementing a Binary Tree in Kotlin](https://www.baeldung.com/kotlin-binary-tree)
- [JUnit 5 for Kotlin Developers](https://www.baeldung.com/junit-5-kotlin)
- [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class)

View File

@ -0,0 +1,29 @@
<?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</artifactId>
<name>core-kotlin</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.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<junit.platform.version>1.1.1</junit.platform.version>
</properties>
</project>

View File

@ -1,4 +1,4 @@
package com.baeldung.java;
package com.baeldung.interoperability;
import java.io.File;
import java.io.FileReader;

View File

@ -1,4 +1,4 @@
package com.baeldung.java;
package com.baeldung.interoperability;
public class Customer {

View File

@ -1,4 +1,4 @@
package com.baeldung.java;
package com.baeldung.introduction;
public class StringUtils {
public static String toUpperCase(String name) {

View File

@ -1,7 +1,6 @@
package com.baeldung.mavenjavakotlin;
import com.baeldung.mavenjavakotlin.services.JavaService;
import com.baeldung.mavenjavakotlin.services.KotlinService;
public class Application {

View File

@ -1,4 +1,4 @@
package com.baeldung.datastructures
package com.baeldung.binarytree
/**
* Example of how to use the {@link Node} class.

View File

@ -1,13 +1,13 @@
package com.baeldung.datastructures
package com.baeldung.binarytree
/**
* An ADT for a binary search tree.
* Note that this data type is neither immutable nor thread safe.
*/
class Node(
var key: Int,
var left: Node? = null,
var right: Node? = null) {
var key: Int,
var left: Node? = null,
var right: Node? = null) {
/**
* Return a node with given value. If no such node exists, return null.

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.introduction
fun main(args: Array<String>){
println("hello word")

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.introduction
open class Item(val id: String, val name: String = "unknown_name") {
open fun getIdOfItem(): String {

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.introduction
import java.util.*

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.introduction
import java.util.concurrent.ThreadLocalRandom

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.introduction
class MathematicsOperations {
fun addTwoNumbers(a: Int, b: Int): Int {

View File

@ -1,4 +1,4 @@
package com.baeldung.mavenjavakotlin.services
package com.baeldung.mavenjavakotlin
class KotlinService {

View File

@ -1,7 +1,5 @@
package com.baeldung.sorting
import kotlin.comparisons.*
fun sortMethodUsage() {
val sortedValues = mutableListOf(1, 2, 7, 6, 5, 6)
sortedValues.sort()

View File

@ -1,7 +1,8 @@
package com.baeldung.datastructures
package com.baeldung.binarytree
import org.junit.After
import org.junit.Assert.*
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Before
import org.junit.Test
@ -69,8 +70,10 @@ class NodeTest {
@Test
fun givenDepthTwo_whenPivotAtDepth2_then_Success() {
val left = Node(1, Node(0), Node(2))
val right = Node(5, Node(4), Node(6))
val left =
Node(1, Node(0), Node(2))
val right =
Node(5, Node(4), Node(6))
val n = Node(3, left, right)
assertEquals(left.left, n.find(0))
}
@ -243,7 +246,8 @@ class NodeTest {
*/
@Test
fun givenTreeDepthOne_whenValueAbsent_thenNoChange() {
val n = Node(1, Node(0), Node(2))
val n =
Node(1, Node(0), Node(2))
n.delete(3)
assertEquals(1, n.key)
assertEquals(2, n.right!!.key)
@ -281,7 +285,11 @@ class NodeTest {
*/
@Test
fun givenTreeDepthTwo_whenNodeToDeleteHasOneChild_thenChangeTree() {
val n = Node(2, Node(0, null, Node(1)), Node(3))
val n = Node(
2,
Node(0, null, Node(1)),
Node(3)
)
n.delete(0)
assertEquals(2, n.key)
with(n.right!!) {
@ -298,8 +306,13 @@ class NodeTest {
@Test
fun givenTreeDepthThree_whenNodeToDeleteHasTwoChildren_thenChangeTree() {
val l = Node(2, Node(1), Node(5, Node(4), Node(6)))
val r = Node(10, Node(9), Node(11))
val l = Node(
2,
Node(1),
Node(5, Node(4), Node(6))
)
val r =
Node(10, Node(9), Node(11))
val n = Node(8, l, r)
n.delete(8)
assertEquals(6, n.key)

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin.gson
package com.baeldung.gson
import com.google.gson.Gson
@ -11,7 +11,7 @@ class GsonUnitTest {
@Test
fun givenObject_thenGetJSONString() {
var jsonString = gson.toJson(TestModel(1,"Test"))
var jsonString = gson.toJson(TestModel(1, "Test"))
Assert.assertEquals(jsonString, "{\"id\":1,\"description\":\"Test\"}")
}

View File

@ -1,7 +1,5 @@
package com.baeldung.kotlin
package com.baeldung.interoperability
import com.baeldung.java.ArrayExample
import com.baeldung.java.Customer
import org.junit.Test
import kotlin.test.assertEquals
@ -9,7 +7,7 @@ class ArrayTest {
@Test
fun givenArray_whenValidateArrayType_thenComplete () {
val ex = ArrayExample()
val ex = com.baeldung.interoperability.ArrayExample()
val numArray = intArrayOf(1, 2, 3)
assertEquals(ex.sumValues(numArray), 6)
@ -17,7 +15,7 @@ class ArrayTest {
@Test
fun givenCustomer_whenGetSuperType_thenComplete() {
val instance = Customer::class
val instance = com.baeldung.interoperability.Customer::class
val supertypes = instance.supertypes
assertEquals(supertypes[0].toString(), "kotlin.Any")
@ -25,15 +23,15 @@ class ArrayTest {
@Test
fun givenCustomer_whenGetConstructor_thenComplete() {
val instance = Customer::class.java
val instance = com.baeldung.interoperability.Customer::class.java
val constructors = instance.constructors
assertEquals(constructors.size, 1)
assertEquals(constructors[0].name, "com.baeldung.java.Customer")
assertEquals(constructors[0].name, "com.baeldung.interoperability.Customer")
}
fun makeReadFile() {
val ax = ArrayExample()
val ax = com.baeldung.interoperability.ArrayExample()
ax.writeList()
}
}

View File

@ -1,6 +1,5 @@
package com.baeldung.kotlin
package com.baeldung.interoperability
import com.baeldung.java.Customer
import org.junit.Test
import kotlin.test.assertEquals
@ -8,7 +7,7 @@ class CustomerTest {
@Test
fun givenCustomer_whenNameAndLastNameAreAssigned_thenComplete() {
val customer = Customer()
val customer = com.baeldung.interoperability.Customer()
// Setter method is being called
customer.firstName = "Frodo"

View File

@ -1,9 +1,10 @@
package com.baeldung.kotlin
package com.baeldung.introduction
import org.junit.Test
import kotlin.test.assertNotNull
class ItemServiceTest {
@Test
fun givenItemId_whenGetForOptionalItem_shouldMakeActionOnNonNullValue() {
//given

View File

@ -1,6 +1,5 @@
package com.baeldung.kotlin
package com.baeldung.introduction
import com.baeldung.java.StringUtils
import org.junit.Test
import kotlin.test.assertEquals

View File

@ -1,10 +1,11 @@
package com.baeldung.kotlin
package com.baeldung.introduction
import org.junit.Test
import kotlin.test.assertEquals
class LambdaTest {
@Test
fun givenListOfNumber_whenDoingOperationsUsingLambda_shouldReturnProperResult() {
//given

View File

@ -1,12 +1,12 @@
package com.baeldung.kotlin
package com.baeldung.introduction
import com.baeldung.kotlin.ListExtension
import org.junit.Test
import kotlin.test.assertTrue
class ListExtensionTest {
@Test
fun givenList_whenExecuteExtensionFunctionOnList_shouldReturnRandomElementOfList(){
fun givenList_whenExecuteExtensionFunctionOnList_shouldReturnRandomElementOfList() {
//given
val elements = listOf("a", "b", "c")

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin.junit5
package com.baeldung.junit5
class Calculator {
fun add(a: Int, b: Int) = a + b

View File

@ -1,9 +1,9 @@
package com.baeldung.kotlin.junit5
package com.baeldung.junit5
import org.junit.jupiter.api.*
import org.junit.jupiter.api.function.Executable
class CalculatorTest5 {
class CalculatorUnitTest {
private val calculator = Calculator()
@Test

View File

@ -1,3 +1,3 @@
package com.baeldung.kotlin.junit5
package com.baeldung.junit5
class DivideByZeroException(val numerator: Int) : Exception()

View File

@ -1,10 +1,10 @@
package com.baeldung.kotlin.junit5
package com.baeldung.junit5
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
class SimpleTest5 {
class SimpleUnitTest {
@Test
fun `isEmpty should return true for empty lists`() {

View File

@ -1,9 +1,8 @@
package com.baeldung.sorting
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.*
class SortingExampleKtTest {
@Test

View File

@ -15,6 +15,7 @@
</parent>
<modules>
<module>core-kotlin</module>
<module>core-kotlin-advanced</module>
<module>core-kotlin-annotations</module>
<module>core-kotlin-collections</module>

View File

@ -4,16 +4,7 @@ This module contains articles about core Kotlin.
### Relevant articles:
- [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin)
- [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability)
- [JUnit 5 for Kotlin Developers](https://www.baeldung.com/junit-5-kotlin)
- [Create a Java and Kotlin Project with Maven](https://www.baeldung.com/kotlin-maven-java-project)
- [Get a Random Number in Kotlin](https://www.baeldung.com/kotlin-random-number)
- [Creational Design Patterns in Kotlin: Builder](https://www.baeldung.com/kotlin-builder-pattern)
- [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)
- [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)
- More articles: [[next -->]](/core-kotlin-2)

View File

@ -19,12 +19,6 @@
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
@ -70,7 +64,6 @@
</dependencies>
<properties>
<junit.platform.version>1.1.1</junit.platform.version>
<junit.vintage.version>5.2.0</junit.vintage.version>
<assertj.version>3.10.0</assertj.version>
<fuel.version>1.15.0</fuel.version>