Skip to content

Commit 4ba3b74

Browse files
authored
Merge pull request eugenp#6260 from alimate/BAEL-2658
Refactored the test names and used backtick identifiers.
2 parents eed4d8f + 425b890 commit 4ba3b74

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/CalculatorTest5.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ class CalculatorTest5 {
77
private val calculator = Calculator()
88

99
@Test
10-
fun whenAdding1and3_thenAnswerIs4() {
10+
fun `Adding 1 and 3 should be eqaul to 4`() {
1111
Assertions.assertEquals(4, calculator.add(1, 3))
1212
}
1313

1414
@Test
15-
fun whenDividingBy0_thenErrorOccurs() {
15+
fun `Dividing by zero should throw the DivideByZeroException`() {
1616
val exception = Assertions.assertThrows(DivideByZeroException::class.java) {
1717
calculator.divide(5, 0)
1818
}
@@ -21,7 +21,7 @@ class CalculatorTest5 {
2121
}
2222

2323
@Test
24-
fun whenSquaringNumbers_thenCorrectAnswerGiven() {
24+
fun `The square of a number should be eqaul to that number multiplied in itself`() {
2525
Assertions.assertAll(
2626
Executable { Assertions.assertEquals(1, calculator.square(1)) },
2727
Executable { Assertions.assertEquals(4, calculator.square(2)) },
@@ -76,7 +76,7 @@ class CalculatorTest5 {
7676
Tag("logarithms")
7777
)
7878
@Test
79-
fun whenIcalculateLog2Of8_thenIget3() {
79+
fun `Log to base 2 of 8 should be equal to 3`() {
8080
Assertions.assertEquals(3.0, calculator.log(2, 8))
8181
}
8282
}

core-kotlin/src/test/kotlin/com/baeldung/kotlin/junit5/SimpleTest5.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import org.junit.jupiter.api.Disabled
55
import org.junit.jupiter.api.Test
66

77
class SimpleTest5 {
8+
89
@Test
9-
fun whenEmptyList_thenListIsEmpty() {
10+
fun `isEmpty should return true for empty lists`() {
1011
val list = listOf<String>()
1112
Assertions.assertTrue(list::isEmpty)
1213
}
1314

1415
@Test
1516
@Disabled
16-
fun when3equals4_thenTestFails() {
17+
fun `3 is equal to 4`() {
1718
Assertions.assertEquals(3, 4) {
1819
"Three does not equal four"
1920
}

0 commit comments

Comments
 (0)