test_class.declarator: crudRepository
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private LocationCrudRepository crudRepository;
test_class.type: LocationCrudRepository
test_class.var_name: crudRepository
test_class.declarator: repository
test_class.modifier: @InjectMocks
      private
test_class.original_string: @InjectMocks
      private LocationRepositoryImpl repository;
test_class.type: LocationRepositoryImpl
test_class.var_name: repository
test_class.declarator: locationEntityCaptor
test_class.modifier: @Captor
      private
test_class.original_string: @Captor
      private ArgumentCaptor<LocationEntity> locationEntityCaptor;
test_class.type: ArgumentCaptor<LocationEntity>
test_class.var_name: locationEntityCaptor
test_class.declarator: testLocation = new Location(76, Coordinates.valueOf(1.2, 3.4), "description")
test_class.modifier: private final
test_class.original_string: private final Location testLocation = new Location(76, Coordinates.valueOf(1.2, 3.4), "description");
test_class.type: Location
test_class.var_name: testLocation
test_class.file: optaweb-vehicle-routing-backend/src/test/java/org/optaweb/vehiclerouting/plugin/persistence/LocationRepositoryImplTest.java
test_class.identifier: LocationRepositoryImplTest
test_case.body: @Test
      void should_create_location_and_generate_id() {
          // arrange
          LocationEntity newEntity = locationEntity(testLocation);
          when(crudRepository.save(locationEntityCaptor.capture())).thenReturn(newEntity);
          Coordinates savedCoordinates = Coordinates.valueOf(0.00213, 32.777);
          String savedDescription = "new location";
  
          // act
          Location newLocation = repository.createLocation(savedCoordinates, savedDescription);
  
          // assert
          // -- the correct values were used to save the entity
          LocationEntity savedLocation = locationEntityCaptor.getValue();
          assertThat(savedLocation.getLatitude()).isEqualTo(savedCoordinates.latitude());
          assertThat(savedLocation.getLongitude()).isEqualTo(savedCoordinates.longitude());
          assertThat(savedLocation.getDescription()).isEqualTo(savedDescription);
  
          // -- created domain location is equal to the entity returned by repository.save()
          // This may be confusing but that's the contract of Spring Repository API.
          // The entity instance that is being saved is meant to be discarded. The returned instance should be used
          // for further operations as the save() operation may update it (for example generate the ID).
          assertThat(newLocation.id()).isEqualTo(newEntity.getId());
          assertThat(newLocation.coordinates())
                  .isEqualTo(new Coordinates(newEntity.getLatitude(), newEntity.getLongitude()));
          assertThat(newLocation.description()).isEqualTo(newEntity.getDescription());
      }
test_case.class_method_signature: LocationRepositoryImplTest.should_create_location_and_generate_id()
test_case.full_signature: @Test void should_create_location_and_generate_id()
test_case.identifier: should_create_location_and_generate_id
test_case.invocations: locationEntity thenReturn when save capture valueOf createLocation getValue isEqualTo assertThat getLatitude latitude isEqualTo assertThat getLongitude longitude isEqualTo assertThat getDescription isEqualTo assertThat id getId isEqualTo assertThat coordinates getLatitude getLongitude isEqualTo assertThat description getDescription
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_create_location_and_generate_id()
focal_class.declarator: logger = LoggerFactory.getLogger(LocationRepositoryImpl.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(LocationRepositoryImpl.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: repository
focal_class.modifier: private final
focal_class.original_string: private final LocationCrudRepository repository;
focal_class.type: LocationCrudRepository
focal_class.var_name: repository
focal_class.file: optaweb-vehicle-routing-backend/src/main/java/org/optaweb/vehiclerouting/plugin/persistence/LocationRepositoryImpl.java
focal_class.identifier: LocationRepositoryImpl
focal_class.interfaces: implements LocationRepository
focal_class.class_method_signature: LocationRepositoryImpl.LocationRepositoryImpl(LocationCrudRepository repository)
focal_class.full_signature: @Autowired  LocationRepositoryImpl(LocationCrudRepository repository)
focal_class.identifier: LocationRepositoryImpl
focal_class.modifiers: @Autowired
focal_class.parameters: (LocationCrudRepository repository)
focal_class.signature:  LocationRepositoryImpl(LocationCrudRepository repository)
focal_class.class_method_signature: LocationRepositoryImpl.createLocation(Coordinates coordinates, String description)
focal_class.full_signature: @Override public Location createLocation(Coordinates coordinates, String description)
focal_class.identifier: createLocation
focal_class.modifiers: @Override public
focal_class.parameters: (Coordinates coordinates, String description)
focal_class.return: Location
focal_class.signature: Location createLocation(Coordinates coordinates, String description)
focal_class.class_method_signature: LocationRepositoryImpl.locations()
focal_class.full_signature: @Override public List<Location> locations()
focal_class.identifier: locations
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<Location>
focal_class.signature: List<Location> locations()
focal_class.class_method_signature: LocationRepositoryImpl.removeLocation(long id)
focal_class.full_signature: @Override public Location removeLocation(long id)
focal_class.identifier: removeLocation
focal_class.modifiers: @Override public
focal_class.parameters: (long id)
focal_class.return: Location
focal_class.signature: Location removeLocation(long id)
focal_class.class_method_signature: LocationRepositoryImpl.removeAll()
focal_class.full_signature: @Override public void removeAll()
focal_class.identifier: removeAll
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void removeAll()
focal_class.class_method_signature: LocationRepositoryImpl.find(long locationId)
focal_class.full_signature: @Override public Optional<Location> find(long locationId)
focal_class.identifier: find
focal_class.modifiers: @Override public
focal_class.parameters: (long locationId)
focal_class.return: Optional<Location>
focal_class.signature: Optional<Location> find(long locationId)
focal_class.class_method_signature: LocationRepositoryImpl.toDomain(LocationEntity locationEntity)
focal_class.full_signature: private static Location toDomain(LocationEntity locationEntity)
focal_class.identifier: toDomain
focal_class.modifiers: private static
focal_class.parameters: (LocationEntity locationEntity)
focal_class.return: Location
focal_class.signature: Location toDomain(LocationEntity locationEntity)
focal_method.body: @Override
      public Location createLocation(Coordinates coordinates, String description) {
          LocationEntity locationEntity = repository.save(
                  new LocationEntity(0, coordinates.latitude(), coordinates.longitude(), description));
          Location location = toDomain(locationEntity);
          logger.info("Created location {}.", location.fullDescription());
          return location;
      }
focal_method.class_method_signature: LocationRepositoryImpl.createLocation(Coordinates coordinates, String description)
focal_method.full_signature: @Override public Location createLocation(Coordinates coordinates, String description)
focal_method.identifier: createLocation
focal_method.invocations: save latitude longitude toDomain info fullDescription
focal_method.modifiers: @Override public
focal_method.parameters: (Coordinates coordinates, String description)
focal_method.return: Location
focal_method.signature: Location createLocation(Coordinates coordinates, String description)