Search in sources :

Example 1 with AdDescriptionRepository

use of de.spring.example.persistence.repository.AdDescriptionRepository in project JavaForFun by gumartinm.

the class AdDescriptionRevisionServiceShould method test.

@Test
public void test() {
    AdDescriptionRepository adDescriptionRepository = mock(AdDescriptionRepository.class);
    AdDescriptionRevisionServiceImpl adDescriptionRevisionService = new AdDescriptionRevisionServiceImpl();
    adDescriptionRevisionService.setRepository(adDescriptionRepository);
    List<Revision<Integer, AdDescription>> adRevisions = new ArrayList<>();
    Pageable pageRequest = new PageRequest(0, 1);
    Page<Revision<Integer, AdDescription>> page = new PageImpl<>(adRevisions);
    given(adDescriptionRepository.findRevisions(1L, pageRequest)).willReturn(page);
    assertThat(adDescriptionRevisionService.findRevisions(1L, pageRequest), is(page));
}
Also used : PageImpl(org.springframework.data.domain.PageImpl) PageRequest(org.springframework.data.domain.PageRequest) Pageable(org.springframework.data.domain.Pageable) Revision(org.springframework.data.history.Revision) ArrayList(java.util.ArrayList) AdDescriptionRepository(de.spring.example.persistence.repository.AdDescriptionRepository) Test(org.junit.Test)

Aggregations

AdDescriptionRepository (de.spring.example.persistence.repository.AdDescriptionRepository)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 PageImpl (org.springframework.data.domain.PageImpl)1 PageRequest (org.springframework.data.domain.PageRequest)1 Pageable (org.springframework.data.domain.Pageable)1 Revision (org.springframework.data.history.Revision)1