Skip to content

Commit 4c01d56

Browse files
committed
Introduce a FizzBuzz Interface
1 parent b49e709 commit 4c01d56

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package nl.fifthpostulate
2+
3+
interface FizzBuzz {
4+
fun of(n: Int): String
5+
}

src/main/kotlin/nl/fifthpostulate/standard/FizzBuzz.kt renamed to src/main/kotlin/nl/fifthpostulate/standard/Standard.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package nl.fifthpostulate.standard
22

3-
class FizzBuzz {
4-
fun of(n: Int): String {
3+
import nl.fifthpostulate.FizzBuzz
4+
5+
class Standard: FizzBuzz {
6+
override fun of(n: Int): String {
57
if (n % 15 == 0) {
68
return "FizzBuzz"
79
}

src/test/kotlin/nl/fifthpostulate/standard/StandardTest.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package nl.fifthpostulate.standard
22

3+
import nl.fifthpostulate.FizzBuzz
34
import org.junit.jupiter.api.BeforeEach
45
import kotlin.test.Test
56
import kotlin.test.assertEquals
@@ -9,7 +10,7 @@ class StandardTest {
910

1011
@BeforeEach
1112
fun createFizzBuzz() {
12-
fizzbuzz = FizzBuzz()
13+
fizzbuzz = Standard()
1314
}
1415

1516
@Test

0 commit comments

Comments
 (0)