AppService { @Transactional(readOnly = true) public App find(Long id) { App app = appRepository.findOne(id); HeimdallException.checkThrow(app == null, GLOBAL_RESOURCE_NOT_FOUND); app.setAccessTokens(accessTokenRepository.findByAppId(app.getId())); return app; }  @Transactional(readOnly = true) App find(Long id); @Transactional(readOnly = true) AppPage list(AppRequestDTO appDTO, PageableDTO pageableDTO); @Transactional(readOnly = true) List<App> list(AppRequestDTO appDTO); App save(AppPersist appDTO); App update(Long id, AppDTO appDTO); void delete(Long id); @Transactional App save(AppCallbackDTO reqBody);  }
@Test public void findAppTest() { Mockito.when(this.appRepository.findOne(Mockito.any(Long.class))).thenReturn(app); Mockito.when(accessTokenRepository.findByAppId(app.getId())).thenReturn(Mockito.anyList()); App appResp = appService.find(1L); assertEquals(appResp.getId(), app.getId()); Mockito.verify(this.appRepository, Mockito.times(1)).findOne(Mockito.any(Long.class)); }