summaryrefslogtreecommitdiff
path: root/Java-Kompendium/kap26/src/test/java/LibraryTest.java
blob: cdd9ff6ccaa070c3837c8be4e7f0308188704ec8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

class LibraryTest {
    Library sut;

    @BeforeEach
    public void setUp() {
        this.sut = new Library();
    }

    @Test
    void someLibraryMethodReturnsTrue() {
        assertEquals("Hallo Alex!", this.sut.begruessung("Alex"));
    }

    @ParameterizedTest(name = "{0} + {1} = {2}")
    @CsvSource({
            "Oliver, Hallo Oliver!",
            "Susanne, Hallo Susanne!",
            "Christine, Hallo Christine!",
            "Sebastian, Hallo Sebastian!",
            "Katharina, Hallo Katharina!",
    })
    void test(String ueberpruefterWert, String erwartertesErgebnis) {
        assertEquals(erwartertesErgebnis, this.sut.begruessung(ueberpruefterWert));
    }

}