Skip to content

Commit

Permalink
Update combine arrays module
Browse files Browse the repository at this point in the history
  • Loading branch information
enoldev committed Jul 26, 2021
1 parent 6c4db4b commit bedea1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 100 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.baeldung.combine.arrays
package com.baeldung.combinearrays

class MergeArrays {
class CombineArrays {
fun <T> combinePlus(arr1: Array<T>, arr2: Array<T>): Array<T> {
return arr1 + arr2
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
package com.baeldung.combine.arrays
package com.baeldung.combinearrays

import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals

class MergeArraysUnitTest {
class CombineArraysUnitTest {

val arr1 = arrayOf(3, 10, 2)
val arr2 = arrayOf(6, 11, 89, 0)

val expectedMergedArray = arrayOf(3, 10, 2, 6, 11, 89, 0)

lateinit var mergeArrays: MergeArrays
lateinit var mergeArrays: CombineArrays

@BeforeEach
fun setUp() {
mergeArrays = MergeArrays()
mergeArrays = CombineArrays()
}


@Test
fun givenTwoArrays_whenCombinePlusIsCalled_ArraysAreMerged() {
fun `Given two arrays, when combinePlus is called, then arrays are merged`() {
assertEqualArrays(expectedMergedArray, mergeArrays.combinePlus(arr1, arr2))
}

@Test
fun givenTwoArrays_whenCombinePlusOperatorIsCalled_ArraysAreMerged() {
fun `Given two arrays, when combinePlusOperator is called, then arrays are merged`() {
assertEqualArrays(expectedMergedArray, mergeArrays.combinePlusOperator(arr1, arr2))
}

@Test
fun givenTwoArrays_whenCombineSpreadIsCalled_ArraysAreMerged() {
fun `Given two arrays, when combineSpread is called, then arrays are merged`() {
assertEqualArrays(expectedMergedArray, mergeArrays.combineSpread(arr1, arr2))
}

@Test
fun givenTwoArrays_whenCombineCustomIsCalled_ArraysAreMerged() {
fun `Given two arrays, when combineCustom is called, then arrays are merged`() {
assertEqualArrays(expectedMergedArray, mergeArrays.combineCustom(arr1, arr2))
}

Expand Down
89 changes: 0 additions & 89 deletions kotlin-combine-arrays/pom.xml

This file was deleted.

0 comments on commit bedea1e

Please sign in to comment.