Skip to content
Snippets Groups Projects
Commit 117d635b authored by Oto Stanko's avatar Oto Stanko
Browse files

Apparently calling other repos is messing with empty service tests, needs closer look

parent 1b0d6530
No related branches found
No related tags found
2 merge requests!79Final solution of milestone 3,!6223 persisting data
...@@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
/** /**
......
...@@ -38,8 +38,8 @@ public class PersistingCars { ...@@ -38,8 +38,8 @@ public class PersistingCars {
firstCarComponents, firstCarComponents,
firstCarDrivers, firstCarDrivers,
null); null);
Optional<Long> componentId = getRandomComponentId(); // Optional<Long> componentId = getRandomComponentId();
componentId.ifPresent(id -> firstCar.setComponents(new HashSet<>(Collections.singleton(id)))); // componentId.ifPresent(id -> firstCar.setComponents(new HashSet<>(Collections.singleton(id))));
carRepository.save(firstCar); carRepository.save(firstCar);
Set<Long> secondCarComponents = new HashSet(); Set<Long> secondCarComponents = new HashSet();
...@@ -48,8 +48,8 @@ public class PersistingCars { ...@@ -48,8 +48,8 @@ public class PersistingCars {
secondCarComponents, secondCarComponents,
secondCarDrivers, secondCarDrivers,
null); null);
componentId = getRandomComponentId(); // componentId = getRandomComponentId();
componentId.ifPresent(id -> secondCar.setComponents(new HashSet<>(Collections.singleton(id)))); // componentId.ifPresent(id -> secondCar.setComponents(new HashSet<>(Collections.singleton(id))));
carRepository.save(secondCar); carRepository.save(secondCar);
} }
......
...@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication; ...@@ -4,6 +4,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
......
...@@ -5,6 +5,7 @@ import org.springframework.boot.SpringApplication; ...@@ -5,6 +5,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/** /**
* Main app. * Main app.
......
...@@ -9,6 +9,7 @@ import org.springframework.boot.SpringApplication; ...@@ -9,6 +9,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment