### Question:
TppOperationInfoService { public void deleteInfo(Long operationInfoId) { String tppId = validateAndGetTppId(); if (!infoRepository.existsByIdAndTppId(operationInfoId, tppId)) { throw new TppException("Requested data doesnt belong to Your TPP", 403); } infoRepository.deleteById(operationInfoId); }  List<OperationInfo> getOperationsByTypeAndTppId(OperationType operationType); OperationInfo createInfo(OperationInfo operationInfo); void deleteInfo(Long operationInfoId);  }### Answer:
@Test void deleteInfo() { when(userMgmtRestClient.getUser()).thenReturn(ResponseEntity.ok(getUser(UserRoleTO.STAFF))); when(infoRepository.existsByIdAndTppId(anyLong(), anyString())).thenReturn(true); service.deleteInfo(123L); verify(infoRepository, times(1)).existsByIdAndTppId(anyLong(), anyString()); verify(infoRepository, times(1)).deleteById(123L); }
@Test void deleteInfo_info_belongs_to_other_or_non_existent() { when(userMgmtRestClient.getUser()).thenReturn(ResponseEntity.ok(getUser(UserRoleTO.STAFF))); when(infoRepository.existsByIdAndTppId(anyLong(), anyString())).thenReturn(false); assertThrows(TppException.class, () -> service.deleteInfo(123L)); verify(infoRepository, times(1)).existsByIdAndTppId(anyLong(), anyString()); verify(infoRepository, times(0)).deleteById(123L); }