Creating tests for your domain objects
Earlier, we mentioned that testing is a multi-faceted approach. One of the most critical things in any system is its domain types. Testing them is vital. Essentially, anything publicly visible to users is a candidate for writing test cases.
So, let’s start by writing some test cases around the VideoEntity
domain object we defined back in Chapter 3, Querying for Data with Spring Boot:
public class CoreDomainTest { @Test void newVideoEntityShouldHaveNullId() { VideoEntity entity = new VideoEntity("alice", "title", "description"); assertThat(entity.getId()).isNull(); assertThat(entity.getUsername()).isEqualTo("alice"); assertThat(entity.getName()).isEqualTo("title"); assertThat(entity.getDescription()) ...