@Test public void deleteWithNotFoundTest() { thrown.expect(NotFoundException.class); thrown.expectMessage("Resource not found"); Mockito.when(scopeRepository.findByApiIdAndId(Mockito.anyLong(), Mockito.anyLong())).thenReturn(null); scopeService.delete(scope.getApi().getId(), scope.getId()); }
@Transactional public void delete(final Long apiId, final Long scopeId) { Scope scope = scopeRepository.findByApiIdAndId(apiId, scopeId); HeimdallException.checkThrow(scope == null, GLOBAL_RESOURCE_NOT_FOUND); scopeRepository.delete(scope); amqpCacheService.dispatchClean(); }
ScopeService { @Transactional public void delete(final Long apiId, final Long scopeId) { Scope scope = scopeRepository.findByApiIdAndId(apiId, scopeId); HeimdallException.checkThrow(scope == null, GLOBAL_RESOURCE_NOT_FOUND); scopeRepository.delete(scope); amqpCacheService.dispatchClean(); } }
ScopeService { @Transactional public void delete(final Long apiId, final Long scopeId) { Scope scope = scopeRepository.findByApiIdAndId(apiId, scopeId); HeimdallException.checkThrow(scope == null, GLOBAL_RESOURCE_NOT_FOUND); scopeRepository.delete(scope); amqpCacheService.dispatchClean(); }  }
ScopeService { @Transactional public void delete(final Long apiId, final Long scopeId) { Scope scope = scopeRepository.findByApiIdAndId(apiId, scopeId); HeimdallException.checkThrow(scope == null, GLOBAL_RESOURCE_NOT_FOUND); scopeRepository.delete(scope); amqpCacheService.dispatchClean(); }  @Transactional(readOnly = true) Scope find(final Long apiId, final Long scopeId); @Transactional(readOnly = true) ScopePage list(final Long apiId, final ScopeDTO scopeDTO, final PageableDTO pageableDTO); @Transactional(readOnly = true) List<Scope> list(final Long apiId, final ScopeDTO scopeDTO); @Transactional Scope save(final Long apiId, Scope scope); @Transactional void delete(final Long apiId, final Long scopeId); @Transactional Scope update(final Long apiId, final Long scopeId, Scope scope); }
ScopeService { @Transactional public void delete(final Long apiId, final Long scopeId) { Scope scope = scopeRepository.findByApiIdAndId(apiId, scopeId); HeimdallException.checkThrow(scope == null, GLOBAL_RESOURCE_NOT_FOUND); scopeRepository.delete(scope); amqpCacheService.dispatchClean(); }  @Transactional(readOnly = true) Scope find(final Long apiId, final Long scopeId); @Transactional(readOnly = true) ScopePage list(final Long apiId, final ScopeDTO scopeDTO, final PageableDTO pageableDTO); @Transactional(readOnly = true) List<Scope> list(final Long apiId, final ScopeDTO scopeDTO); @Transactional Scope save(final Long apiId, Scope scope); @Transactional void delete(final Long apiId, final Long scopeId); @Transactional Scope update(final Long apiId, final Long scopeId, Scope scope);  }