test_class.declarator: crudRepository
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private DistanceCrudRepository crudRepository;
test_class.type: DistanceCrudRepository
test_class.var_name: crudRepository
test_class.declarator: repository
test_class.modifier: @InjectMocks
      private
test_class.original_string: @InjectMocks
      private DistanceRepositoryImpl repository;
test_class.type: DistanceRepositoryImpl
test_class.var_name: repository
test_class.declarator: distanceEntityArgumentCaptor
test_class.modifier: @Captor
      private
test_class.original_string: @Captor
      private ArgumentCaptor<DistanceEntity> distanceEntityArgumentCaptor;
test_class.type: ArgumentCaptor<DistanceEntity>
test_class.var_name: distanceEntityArgumentCaptor
test_class.declarator: from = new Location(1, Coordinates.valueOf(7, -4.0))
test_class.modifier: private final
test_class.original_string: private final Location from = new Location(1, Coordinates.valueOf(7, -4.0));
test_class.type: Location
test_class.var_name: from
test_class.declarator: to = new Location(2, Coordinates.valueOf(5, 9.0))
test_class.modifier: private final
test_class.original_string: private final Location to = new Location(2, Coordinates.valueOf(5, 9.0));
test_class.type: Location
test_class.var_name: to
test_class.file: optaweb-vehicle-routing-backend/src/test/java/org/optaweb/vehiclerouting/plugin/persistence/DistanceRepositoryImplTest.java
test_class.identifier: DistanceRepositoryImplTest
test_case.body: @Test
      void should_return_distance_when_entity_is_found() {
          DistanceKey distanceKey = new DistanceKey(from.id(), to.id());
          long distance = 10305;
          DistanceEntity distanceEntity = new DistanceEntity(distanceKey, distance);
          when(crudRepository.findById(distanceKey)).thenReturn(Optional.of(distanceEntity));
          assertThat(repository.getDistance(from, to)).isEqualTo(distance);
      }
test_case.class_method_signature: DistanceRepositoryImplTest.should_return_distance_when_entity_is_found()
test_case.full_signature: @Test void should_return_distance_when_entity_is_found()
test_case.identifier: should_return_distance_when_entity_is_found
test_case.invocations: id id thenReturn when findById of isEqualTo assertThat getDistance
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_return_distance_when_entity_is_found()
focal_class.declarator: distanceRepository
focal_class.modifier: private final
focal_class.original_string: private final DistanceCrudRepository distanceRepository;
focal_class.type: DistanceCrudRepository
focal_class.var_name: distanceRepository
focal_class.file: optaweb-vehicle-routing-backend/src/main/java/org/optaweb/vehiclerouting/plugin/persistence/DistanceRepositoryImpl.java
focal_class.identifier: DistanceRepositoryImpl
focal_class.interfaces: implements DistanceRepository
focal_class.class_method_signature: DistanceRepositoryImpl.DistanceRepositoryImpl(DistanceCrudRepository distanceRepository)
focal_class.full_signature: @Autowired  DistanceRepositoryImpl(DistanceCrudRepository distanceRepository)
focal_class.identifier: DistanceRepositoryImpl
focal_class.modifiers: @Autowired
focal_class.parameters: (DistanceCrudRepository distanceRepository)
focal_class.signature:  DistanceRepositoryImpl(DistanceCrudRepository distanceRepository)
focal_class.class_method_signature: DistanceRepositoryImpl.saveDistance(Location from, Location to, long distance)
focal_class.full_signature: @Override public void saveDistance(Location from, Location to, long distance)
focal_class.identifier: saveDistance
focal_class.modifiers: @Override public
focal_class.parameters: (Location from, Location to, long distance)
focal_class.return: void
focal_class.signature: void saveDistance(Location from, Location to, long distance)
focal_class.class_method_signature: DistanceRepositoryImpl.getDistance(Location from, Location to)
focal_class.full_signature: @Override public long getDistance(Location from, Location to)
focal_class.identifier: getDistance
focal_class.modifiers: @Override public
focal_class.parameters: (Location from, Location to)
focal_class.return: long
focal_class.signature: long getDistance(Location from, Location to)
focal_class.class_method_signature: DistanceRepositoryImpl.deleteDistances(Location location)
focal_class.full_signature: @Override public void deleteDistances(Location location)
focal_class.identifier: deleteDistances
focal_class.modifiers: @Override public
focal_class.parameters: (Location location)
focal_class.return: void
focal_class.signature: void deleteDistances(Location location)
focal_class.class_method_signature: DistanceRepositoryImpl.deleteAll()
focal_class.full_signature: @Override public void deleteAll()
focal_class.identifier: deleteAll
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void deleteAll()
focal_method.body: @Override
      public long getDistance(Location from, Location to) {
          Optional<DistanceEntity> optional = distanceRepository.findById(new DistanceKey(from.id(), to.id()));
          if (optional.isPresent()) {
              return optional.get().getDistance();
          }
          return -1;
      }
focal_method.class_method_signature: DistanceRepositoryImpl.getDistance(Location from, Location to)
focal_method.full_signature: @Override public long getDistance(Location from, Location to)
focal_method.identifier: getDistance
focal_method.invocations: findById id id isPresent getDistance get
focal_method.modifiers: @Override public
focal_method.parameters: (Location from, Location to)
focal_method.return: long
focal_method.signature: long getDistance(Location from, Location to)