Skip to content

Commit 294e218

Browse files
committed
[private-constructor] fix copy/paste mistake
1 parent 24b726d commit 294e218

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core-kotlin-modules/core-kotlin-lang-4/src/test/kotlin/com/baeldung/privateConstructor/PrivateConstructorUnitTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ data class StudentData private constructor(val name: String, val age: Int) {
2424
class PrivateConstructorUnitTest {
2525
@Test
2626
fun `when using private constructor then instance can only be created via companion function`() {
27-
// val kai = Student("Kai" to 18)
27+
// val kai = Student("Kai", 18)
2828
// Kotlin: Cannot access '<init>': it is private in 'Student'
2929

3030
val kai = Student.createInstance("Kai" to 18)
@@ -35,7 +35,7 @@ class PrivateConstructorUnitTest {
3535

3636
@Test
3737
fun `when using private constructor in data class then copy() exposes the private constructor`() {
38-
// val kaiData = StudentData("Kai" to 18)
38+
// val kaiData = StudentData("Kai", 18)
3939
// Kotlin: Cannot access '<init>': it is private in 'StudentData'
4040

4141
val kaiData = StudentData.createInstance("Kai" to 18)

0 commit comments

Comments
 (0)