@Test public void findOperation() { Mockito.when(this.operationRepository.findByResourceApiIdAndResourceIdAndId(Mockito.any(Long.class), Mockito.anyLong(), Mockito.anyLong() )).thenReturn(operation); Operation opearationResp = operationService.find(1L, 1L, 1L); assertEquals(opearationResp.getId(), operation.getId()); Mockito.verify(this.operationRepository, Mockito.times(1)) .findByResourceApiIdAndResourceIdAndId(Mockito.any(Long.class), Mockito.anyLong(), Mockito.anyLong() ); }
@Transactional(readOnly = true) public Operation find(Long apiId, Long resourceId, Long operationId) { Operation operation = operationRepository.findByResourceApiIdAndResourceIdAndId(apiId, resourceId, operationId); HeimdallException.checkThrow(operation == null, GLOBAL_RESOURCE_NOT_FOUND); return operation; }
OperationService { @Transactional(readOnly = true) public Operation find(Long apiId, Long resourceId, Long operationId) { Operation operation = operationRepository.findByResourceApiIdAndResourceIdAndId(apiId, resourceId, operationId); HeimdallException.checkThrow(operation == null, GLOBAL_RESOURCE_NOT_FOUND); return operation; } }
OperationService { @Transactional(readOnly = true) public Operation find(Long apiId, Long resourceId, Long operationId) { Operation operation = operationRepository.findByResourceApiIdAndResourceIdAndId(apiId, resourceId, operationId); HeimdallException.checkThrow(operation == null, GLOBAL_RESOURCE_NOT_FOUND); return operation; }  }
OperationService { @Transactional(readOnly = true) public Operation find(Long apiId, Long resourceId, Long operationId) { Operation operation = operationRepository.findByResourceApiIdAndResourceIdAndId(apiId, resourceId, operationId); HeimdallException.checkThrow(operation == null, GLOBAL_RESOURCE_NOT_FOUND); return operation; }  @Transactional(readOnly = true) Operation find(Long apiId, Long resourceId, Long operationId); @Transactional(readOnly = true) OperationPage list(Long apiId, Long resourceId, OperationDTO operationDTO, PageableDTO pageableDTO); @Transactional(readOnly = true) List<Operation> list(Long apiId, Long resourceId, OperationDTO operationDTO); @Transactional(readOnly = true) List<Operation> list(final Long apiId); @Transactional Operation save(Long apiId, Long resourceId, Operation operation); @Transactional Operation update(Long apiId, Long resourceId, Long operationId, OperationDTO operationDTO); @Transactional void delete(Long apiId, Long resourceId, Long operationId); @Transactional void deleteAllfromResource(Long apiId, Long resourceId); }
OperationService { @Transactional(readOnly = true) public Operation find(Long apiId, Long resourceId, Long operationId) { Operation operation = operationRepository.findByResourceApiIdAndResourceIdAndId(apiId, resourceId, operationId); HeimdallException.checkThrow(operation == null, GLOBAL_RESOURCE_NOT_FOUND); return operation; }  @Transactional(readOnly = true) Operation find(Long apiId, Long resourceId, Long operationId); @Transactional(readOnly = true) OperationPage list(Long apiId, Long resourceId, OperationDTO operationDTO, PageableDTO pageableDTO); @Transactional(readOnly = true) List<Operation> list(Long apiId, Long resourceId, OperationDTO operationDTO); @Transactional(readOnly = true) List<Operation> list(final Long apiId); @Transactional Operation save(Long apiId, Long resourceId, Operation operation); @Transactional Operation update(Long apiId, Long resourceId, Long operationId, OperationDTO operationDTO); @Transactional void delete(Long apiId, Long resourceId, Long operationId); @Transactional void deleteAllfromResource(Long apiId, Long resourceId);  }