Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Commit 859c293

Browse files
Tidied up unit tests, added a private variable to DataClassWithAdditionalFields
1 parent 88c9286 commit 859c293

File tree

8 files changed

+22
-17
lines changed

8 files changed

+22
-17
lines changed

kotlin-builder-example-usage/src/main/kotlin/com/thinkinglogic/example/DataClassWithAdditionalFields.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import com.thinkinglogic.builder.annotation.Builder
44

55
@Builder
66
data class DataClassWithAdditionalFields(
7-
val constructorString: String
7+
val constructorString: String,
8+
private val privateString: String
89
) {
910
val nonConstructorString = constructorString + "foo"
1011

kotlin-builder-example-usage/src/test/kotlin/com/thinkinglogic/example/ArraysDataClassTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.thinkinglogic.example
22

3-
import assertk.assertions.isEqualTo
3+
import org.assertj.core.api.Assertions.assertThat
44
import org.junit.jupiter.api.Test
55
import java.time.LocalDate
66

@@ -27,7 +27,7 @@ internal class ArraysDataClassTest {
2727
.build()
2828

2929
// then
30-
assertk.assert(actual).isEqualTo(expected)
30+
assertThat(actual).isEqualTo(expected)
3131
}
3232

3333
}

kotlin-builder-example-usage/src/test/kotlin/com/thinkinglogic/example/ClassWithConstructorParametersTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.thinkinglogic.example
22

3-
import assertk.assertions.isEqualTo
3+
import org.assertj.core.api.Assertions.assertThat
44
import org.junit.jupiter.api.Test
55

66
internal class ClassWithConstructorParametersTest {
@@ -24,7 +24,7 @@ internal class ClassWithConstructorParametersTest {
2424
.build()
2525

2626
// then
27-
assertk.assert(actual).isEqualTo(expected)
27+
assertThat(actual).isEqualTo(expected)
2828
}
2929

3030
@Test
@@ -43,7 +43,7 @@ internal class ClassWithConstructorParametersTest {
4343
.build()
4444

4545
// then
46-
assertk.assert(actual).isEqualTo(expected)
46+
assertThat(actual).isEqualTo(expected)
4747
}
4848

4949
}

kotlin-builder-example-usage/src/test/kotlin/com/thinkinglogic/example/CollectionsDataClassTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.thinkinglogic.example
22

3-
import assertk.assertions.isEqualTo
3+
import org.assertj.core.api.Assertions.assertThat
44
import org.junit.jupiter.api.Test
55
import java.time.LocalDate
66
import java.util.*
@@ -32,7 +32,7 @@ internal class CollectionsDataClassTest {
3232
.build()
3333

3434
// then
35-
assertk.assert(actual).isEqualTo(expected)
35+
assertThat(actual).isEqualTo(expected)
3636
}
3737

3838
}
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
package com.thinkinglogic.example
22

3-
import assertk.assertions.isEqualTo
3+
import org.assertj.core.api.Assertions.assertThat
44
import org.junit.jupiter.api.Test
55

66
internal class DataClassWithAdditionalFieldsTest {
77

88
@Test
99
fun `builder should create object with correct properties`() {
1010
// given
11+
val privateString = "barfoo"
1112
val expected = DataClassWithAdditionalFields(
12-
constructorString = "foobar "
13+
constructorString = "foobar ",
14+
privateString = privateString
1315
)
1416

1517
// when
1618
val actual = DataClassWithAdditionalFieldsBuilder()
1719
.constructorString(expected.constructorString)
20+
.privateString(privateString)
1821
.build()
1922

2023
// then
21-
assertk.assert(actual).isEqualTo(expected)
24+
assertThat(actual).isEqualTo(expected)
2225
}
2326

2427
}

kotlin-builder-example-usage/src/test/kotlin/com/thinkinglogic/example/GenericTypeDataClassTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.thinkinglogic.example
22

3-
import assertk.assertions.isEqualTo
3+
import org.assertj.core.api.Assertions.assertThat
44
import org.junit.jupiter.api.Test
55

66
internal class GenericTypeDataClassTest {
@@ -18,7 +18,7 @@ internal class GenericTypeDataClassTest {
1818
.build()
1919

2020
// then
21-
assertk.assert(actual).isEqualTo(expected)
21+
assertThat(actual).isEqualTo(expected)
2222
}
2323

2424
}

kotlin-builder-example-usage/src/test/kotlin/com/thinkinglogic/example/MutableCollectionsDataClassTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.thinkinglogic.example
22

3-
import assertk.assertions.isEqualTo
3+
import org.assertj.core.api.Assertions.assertThat
44
import org.junit.jupiter.api.Test
55
import java.time.LocalDate
66

@@ -28,7 +28,7 @@ internal class MutableCollectionsDataClassTest {
2828
.build()
2929

3030
// then
31-
assertk.assert(actual).isEqualTo(expected)
31+
assertThat(actual).isEqualTo(expected)
3232
}
3333

3434
}

kotlin-builder-example-usage/src/test/kotlin/com/thinkinglogic/example/SimpleDataClassTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.thinkinglogic.example
33
import assertk.assert
44
import assertk.assertions.*
55
import assertk.catch
6+
import org.assertj.core.api.Assertions.assertThat
67
import org.junit.jupiter.api.Test
78
import java.time.LocalDate
89

@@ -30,7 +31,7 @@ internal class SimpleDataClassTest {
3031
.build()
3132

3233
// then
33-
assert(actual).isEqualTo(expected)
34+
assertThat(actual).isEqualTo(expected)
3435
}
3536

3637
@Test
@@ -53,7 +54,7 @@ internal class SimpleDataClassTest {
5354
.build()
5455

5556
// then
56-
assert(actual).isEqualTo(expected)
57+
assertThat(actual).isEqualTo(expected)
5758
}
5859

5960
@Test

0 commit comments

Comments
 (0)