Skip to content

Commit 957fdda

Browse files
committed
Create a test case with JUnit 5 and TestAsYouThink Core.
1 parent 94c9dc1 commit 957fdda

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

src/test/java/kata/KataTest.java

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*-
2+
* #%L
3+
* Code Kata
4+
* %%
5+
* Copyright (C) 2019 Chrysocode
6+
* %%
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as
9+
* published by the Free Software Foundation, either version 3 of the
10+
* License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public
18+
* License along with this program. If not, see
19+
* <http://www.gnu.org/licenses/gpl-3.0.html>.
20+
* #L%
21+
*/
22+
23+
package kata;
24+
25+
import org.junit.jupiter.api.Test;
26+
27+
import static org.assertj.core.api.Assertions.assertThat;
28+
import static testasyouthink.TestAsYouThink.givenSut;
29+
import static testasyouthink.TestAsYouThink.resultOf;
30+
import static testasyouthink.TestAsYouThink.when;
31+
32+
class KataTest {
33+
34+
@Test
35+
void should_behave_given_context() {
36+
// Choose the proper syntax for your test case.
37+
38+
resultOf(() -> "TestAsYouThink").isEqualTo("TestAsYouThink");
39+
40+
when(() -> "TestAsYouThink").then(result -> {
41+
assertThat(result)
42+
.startsWith("Test")
43+
.hasSize(14);
44+
});
45+
46+
givenSut(StringBuilder::new)
47+
.whenSutRuns(sut -> sut
48+
.append("TestAsYouThink")
49+
.reverse())
50+
.then(sut -> assertThat(sut).containsSequence("knihTuoYsAtseT"));
51+
}
52+
}

0 commit comments

Comments
 (0)