tests ?
This commit is contained in:
parent
8403bc0592
commit
6861d07dfc
@ -124,6 +124,7 @@ public class EntrepreneurService {
|
||||
}
|
||||
|
||||
public void validateEntrepreneurById(Long id) {
|
||||
System.out.println("\nVALIDATING\n");
|
||||
Optional<Entrepreneur> e = this.entrepreneurRepository.findById(id);
|
||||
if (e.isEmpty()) {
|
||||
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Entrepreneur n'existe pas");
|
||||
|
@ -29,8 +29,10 @@ public class AdminApiServiceTest {
|
||||
private static long administratorid;
|
||||
private static Administrator administrator;
|
||||
private static Entrepreneur entrepreneur;
|
||||
private static Appointment appt;
|
||||
@Autowired private AdminApiService adminApiService;
|
||||
@Autowired private ProjectService projectService;
|
||||
@Autowired private EntrepreneurService entrepreneurService;
|
||||
|
||||
@BeforeAll
|
||||
static void setup(
|
||||
@ -84,7 +86,7 @@ public class AdminApiServiceTest {
|
||||
|
||||
entrepreneurService.updateEntrepreneurProjectParticipation(entrepreneur2.getIdUser(), p);
|
||||
|
||||
Appointment a =
|
||||
appt =
|
||||
new Appointment(
|
||||
null,
|
||||
LocalDate.now(),
|
||||
@ -92,7 +94,7 @@ public class AdminApiServiceTest {
|
||||
LocalTime.now(),
|
||||
"Salle TD 15",
|
||||
"Discussion importante");
|
||||
appoitmentService.addNewAppointment(a);
|
||||
appoitmentService.addNewAppointment(appt);
|
||||
}
|
||||
|
||||
private <T> List<T> IterableToList(Iterable<T> iterable) {
|
||||
@ -291,4 +293,19 @@ public class AdminApiServiceTest {
|
||||
this.adminApiService.getUpcomingAppointments("Entrepreneur2@inpulse.com");
|
||||
assertEquals(0, IterableToList(a).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void validateEntrepreneurAccount() {
|
||||
assertTrue(entrepreneurService.getEntrepreneurById(entrepreneur.getIdUser()).isPending());
|
||||
adminApiService.validateEntrepreneurAccount(entrepreneur.getIdUser(), "");
|
||||
assertFalse(entrepreneurService.getEntrepreneurById(entrepreneur.getIdUser()).isPending());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCreateApptRepport() {
|
||||
this.adminApiService.createAppointmentReport(
|
||||
appt.getIdAppointment(),
|
||||
new Report(null, "je rapporte de fou"),
|
||||
"testAdminFull@example.com");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user