Service fix, add Location and add location to client done
This commit is contained in:
@@ -3,6 +3,7 @@ package fr.eni.demo;
|
||||
import fr.eni.demo.bll.ClientService;
|
||||
import fr.eni.demo.bll.LocationService;
|
||||
import fr.eni.demo.bo.Client;
|
||||
import fr.eni.demo.bo.Location;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -27,6 +28,43 @@ class DemoApplicationTests {
|
||||
client.setPrenom("Olivier");
|
||||
|
||||
clientService.add(client);
|
||||
System.out.println(client);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("-- Test add Location --")
|
||||
void testAddLocation() {
|
||||
Location location = new Location();
|
||||
location.setRue("18 Rue de la Paix");
|
||||
location.setCodePostal("75000");
|
||||
location.setVille("Paris");
|
||||
|
||||
locationService.add(location);
|
||||
System.out.println(location);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("-- Test add Client with Location --")
|
||||
void testAddClientWithLocation() {
|
||||
// Création du client
|
||||
Client client = new Client();
|
||||
client.setEmail("julien@test.fr");
|
||||
client.setNom("Chateau");
|
||||
client.setPrenom("Julien");
|
||||
|
||||
//Création de la location
|
||||
Location location = new Location();
|
||||
location.setRue("666 Rue des Enfers");
|
||||
location.setCodePostal("44000");
|
||||
location.setVille("Nantes");
|
||||
locationService.add(location);
|
||||
|
||||
//Ajout de la location au client
|
||||
client.setLocation(location);
|
||||
clientService.add(client);
|
||||
|
||||
System.out.println(client);
|
||||
System.out.println(location);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user