@Test public void deleteAnAccessToken() { AccessToken recoverAt = new AccessToken(); recoverAt.setCode("123456"); Mockito.when(accessTokenRepository.findOne(Mockito.anyLong())).thenReturn(recoverAt); this.service.delete(1L); Mockito.verify(this.accessTokenRepository, Mockito.times(1)).delete(recoverAt); }
@Transactional public void delete(Long id) { AccessToken accessToken = accessTokenRepository.findOne(id); HeimdallException.checkThrow(accessToken == null, GLOBAL_RESOURCE_NOT_FOUND); amqpCacheService.dispatchClean(); accessTokenRepository.delete(accessToken); }
AccessTokenService { @Transactional public void delete(Long id) { AccessToken accessToken = accessTokenRepository.findOne(id); HeimdallException.checkThrow(accessToken == null, GLOBAL_RESOURCE_NOT_FOUND); amqpCacheService.dispatchClean(); accessTokenRepository.delete(accessToken); } }
AccessTokenService { @Transactional public void delete(Long id) { AccessToken accessToken = accessTokenRepository.findOne(id); HeimdallException.checkThrow(accessToken == null, GLOBAL_RESOURCE_NOT_FOUND); amqpCacheService.dispatchClean(); accessTokenRepository.delete(accessToken); }  }
AccessTokenService { @Transactional public void delete(Long id) { AccessToken accessToken = accessTokenRepository.findOne(id); HeimdallException.checkThrow(accessToken == null, GLOBAL_RESOURCE_NOT_FOUND); amqpCacheService.dispatchClean(); accessTokenRepository.delete(accessToken); }  @Transactional(readOnly = true) AccessToken find(Long id); @Transactional(readOnly = true) AccessTokenPage list(AccessTokenRequest accessTokenRequest, PageableDTO pageableDTO); @Transactional(readOnly = true) List<AccessToken> list(AccessTokenRequest accessTokenRequest); @Transactional AccessToken save(AccessTokenPersist accessTokenPersist); @Transactional AccessToken update(Long id, AccessTokenPersist accessTokenPersist); @Transactional void delete(Long id); @Transactional AccessToken save(AccessTokenDTO reqBody); }
AccessTokenService { @Transactional public void delete(Long id) { AccessToken accessToken = accessTokenRepository.findOne(id); HeimdallException.checkThrow(accessToken == null, GLOBAL_RESOURCE_NOT_FOUND); amqpCacheService.dispatchClean(); accessTokenRepository.delete(accessToken); }  @Transactional(readOnly = true) AccessToken find(Long id); @Transactional(readOnly = true) AccessTokenPage list(AccessTokenRequest accessTokenRequest, PageableDTO pageableDTO); @Transactional(readOnly = true) List<AccessToken> list(AccessTokenRequest accessTokenRequest); @Transactional AccessToken save(AccessTokenPersist accessTokenPersist); @Transactional AccessToken update(Long id, AccessTokenPersist accessTokenPersist); @Transactional void delete(Long id); @Transactional AccessToken save(AccessTokenDTO reqBody);  }