Update Home

djmil 2023-07-18 16:27:10 +02:00
parent 7a6f6765de
commit 8a8ce2bfb5

32
Home.md

@ -22,3 +22,35 @@ Essentially, this will generate a default minimalistic jet functional SpringBoot
# TDD
## myFirstTest
Let's start with the simplest thing you can imagine: a single test method with a single statement. Create [src/test/java/example/cashcard/CashCardJsonTest.java](http://192.168.8.55:3000/HQLAx/FamilyCashCard/src/commit/5ff71154302523ab5ebd0a291e3f5819aed8fdb9/src/test/java/djmil/cashcard/CashCardJsonTest.java):
``` java
package example.cashcard;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class CashCardJsonTest {
@Test
public void myFirstTest() {
assertThat(1).isEqualTo(42);
}
}
```
The `@Test` annotation is part of the JUnit library, and the `assertThat` method is part of the AssertJ library. Both of these libraries are imported after the package statement.
A common convention (but not a requirement) is to always use the Test suffix for test classes. Weve done that here. The full class name CashCardJsonTest.java gives you a clue about the nature of the test we're about to write.
In true Test-First fashion, we've written a failing test first. It's important to have a failing test first so you can have high confidence that whatever you did to fix the test actually worked.
Toggle terminal with `ctrl+tilda` and type
```bash
./gradlew test
```
## Testing the Data Contract