|
@ -2,12 +2,17 @@ package hs.fulda.de.ci.exam.project; |
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.*; |
|
|
import org.junit.jupiter.api.*; |
|
|
import org.junit.jupiter.api.extension.ExtendWith; |
|
|
import org.junit.jupiter.api.extension.ExtendWith; |
|
|
|
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
|
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
import org.junit.jupiter.params.provider.ValueSource; |
|
|
import org.mockito.InjectMocks; |
|
|
import org.mockito.InjectMocks; |
|
|
import org.mockito.Mock; |
|
|
import org.mockito.Mock; |
|
|
import org.mockito.junit.jupiter.MockitoExtension; |
|
|
import org.mockito.junit.jupiter.MockitoExtension; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Arrays; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.assertThrows; |
|
|
import static org.junit.jupiter.api.Assertions.assertThrows; |
|
@ -44,10 +49,23 @@ public class AccountTest { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
@DisplayName("Should Not Create Itinerary when Starting Airport is null") |
|
|
|
|
|
|
|
|
@DisplayName("Should Not add Account details when Person Name is null") |
|
|
public void shouldThrowRuntimeExceptionWhenPersonNameIsNull(){ |
|
|
public void shouldThrowRuntimeExceptionWhenPersonNameIsNull(){ |
|
|
|
|
|
assertThrows(RuntimeException.class, () -> { |
|
|
|
|
|
account1.addAccountDetails(null, address1,"max.mustermann@gmail.com", "0151283290" ); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@DisplayName("Check if the Email is valid") |
|
|
|
|
|
@ParameterizedTest |
|
|
|
|
|
@MethodSource("phoneNumberList") |
|
|
|
|
|
public void shouldThrowRuntimeExceptionWhenPhoneNumberIsNull(String phoneNumber){ |
|
|
assertThrows(RuntimeException.class, () -> { |
|
|
assertThrows(RuntimeException.class, () -> { |
|
|
account1.addAccountDetails(null, address1,"max.mustermann@gmail.com", "015147890206" ); |
|
|
|
|
|
|
|
|
account1.addAccountDetails(null, address1,"max.mustermann@gmail.com", phoneNumber); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static List<String> phoneNumberList() { |
|
|
|
|
|
return Arrays.asList("1234567", "0123", "0125314622696456", "0abnajf"); |
|
|
|
|
|
} |
|
|
} |
|
|
} |