Mercurial > hg > SpringPlayground
diff spring-boot-playground/src/test/java/de/comline/spring/service/MovieRepositoryTestWithoutSpring.java @ 14:4594ff529ab1
Noch ein Test ganz ohne Spring hinzugefuegt.
author | Dirk Olmes <dirk.olmes@codedo.de> |
---|---|
date | Mon, 17 Aug 2020 14:39:26 +0200 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spring-boot-playground/src/test/java/de/comline/spring/service/MovieRepositoryTestWithoutSpring.java Mon Aug 17 14:39:26 2020 +0200 @@ -0,0 +1,23 @@ +package de.comline.spring.service; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import de.comline.spring.entity.Movie; + +public class MovieRepositoryTestWithoutSpring { + @Test + @DisplayName("Test with hand-wired service and repository, without Spring") + public void serviceTestWithoutSpring() { + MovieService service = new MovieService(); + service.repository = RepositoryMocker.createMockRepository(); + + String title = "the-movie-title"; + + Movie movie = service.createMovie(title); + assertThat(movie.getTitle(), is(title)); + } +}