comparison 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
comparison
equal deleted inserted replaced
13:a633d0623278 14:4594ff529ab1
1 package de.comline.spring.service;
2
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.hamcrest.Matchers.is;
5
6 import org.junit.jupiter.api.DisplayName;
7 import org.junit.jupiter.api.Test;
8
9 import de.comline.spring.entity.Movie;
10
11 public class MovieRepositoryTestWithoutSpring {
12 @Test
13 @DisplayName("Test with hand-wired service and repository, without Spring")
14 public void serviceTestWithoutSpring() {
15 MovieService service = new MovieService();
16 service.repository = RepositoryMocker.createMockRepository();
17
18 String title = "the-movie-title";
19
20 Movie movie = service.createMovie(title);
21 assertThat(movie.getTitle(), is(title));
22 }
23 }