BAEL-6212: rich domain model support

This commit is contained in:
emanueltrandafir1993
2023-02-24 17:01:02 +01:00
parent ba8f9a6437
commit d12badec9b
4 changed files with 168 additions and 0 deletions
@@ -0,0 +1,33 @@
package com.baeldung.pattern.richdomainmodel;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
public class RichDomainModelUnitTest {
@Test
public void givenATennisGame_whenReceiverWinsThreePoints_thenScoreIsFortyLove() {
TennisGame game = new TennisGame("server", "receiver");
game.wonPoint("server");
game.wonPoint("server");
game.wonPoint("server");
assertThat(game.getScore())
.isEqualTo("Forty-Love");
}
@Test
public void givenATennisGame_whenEachPlayerWonTwoPoints_thenScoreIsThirtyAll() {
TennisGame game = new TennisGame("server", "receiver");
game.wonPoint("server");
game.wonPoint("server");
game.wonPoint("receiver");
game.wonPoint("receiver");
assertThat(game.getScore())
.isEqualTo("Thirty-All");
}
}