Mercurial > hg > SpringPlayground
view spring-boot-playground/src/test/java/de/comline/spring/service/RepositoryMocker.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 source
package de.comline.spring.service; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import de.comline.spring.repository.MovieRepository; class RepositoryMocker { public static MovieRepository createMockRepository() { MovieRepository mockRepository = mock(MovieRepository.class); when(mockRepository.save(any())).thenAnswer(invocation -> { return invocation.getArgument(0); }); return mockRepository; } }