-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Basic] Task 5 Creating Classes (#10)
* basics 5 and test * Changes made after review * Added description about the class * Edited line no.07 from Basics05 to Basics05Solution
- Loading branch information
Showing
4 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package de.thermondo.basics | ||
|
||
/** | ||
* Use the `class` keyword to define a class. | ||
* Class naming is done in upper camel case. | ||
* | ||
* Create a class named Basics05 | ||
* | ||
* Define member variables: | ||
* name: String | ||
* age: Int | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package de.thermondo.basics | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertNotNull | ||
|
||
class Basics5Test { | ||
|
||
private val clazz = Basics5() | ||
|
||
@Test | ||
fun `Validate that class exists`() { | ||
assertNotNull(clazz) | ||
} | ||
|
||
@Test | ||
fun `Validate name is Kotlin`() { | ||
assertEquals(expected = "Kotlin", actual = clazz.name) | ||
} | ||
|
||
@Test | ||
fun `Validate age is 26`() { | ||
assertEquals(expected = 26, actual = clazz.age) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
solutions/src/main/kotlin/de/thermondo/solutions/basics/Basics05Solution.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package de.thermondo.solutions.basics | ||
|
||
/** | ||
* Use the `class` keyword to define a class. | ||
* Class naming is done in upper camel case. | ||
* | ||
* Create a class named Basics05Solution | ||
* | ||
* Define member variables: | ||
* name: String | ||
* age: Int | ||
*/ | ||
|
||
@Suppress("MagicNumber") | ||
class Basics05Solution { | ||
val name: String = "Kotlin" | ||
val age: Int = 26 | ||
} |
25 changes: 25 additions & 0 deletions
25
solutions/src/test/kotlin/de/thermondo/solutions/basics/Basics05SolutionTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package de.thermondo.solutions.basics | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertNotNull | ||
|
||
class Basics05SolutionTest { | ||
|
||
private val clazz = Basics05Solution() | ||
|
||
@Test | ||
fun `Validate that class exists`() { | ||
assertNotNull(clazz) | ||
} | ||
|
||
@Test | ||
fun `Validate name is Kotlin`() { | ||
assertEquals(expected = "Kotlin", actual = clazz.name) | ||
} | ||
|
||
@Test | ||
fun `Validate age is 26`() { | ||
assertEquals(expected = 26, actual = clazz.age) | ||
} | ||
} |