Browse Source

account details phone number validation

feature-pr-Person
Sona Markosyan 3 years ago
parent
commit
e9d9f662e8
  1. 22
      src/test/java/hs/fulda/de/ci/exam/project/AccountTest.java

22
src/test/java/hs/fulda/de/ci/exam/project/AccountTest.java

@ -2,12 +2,17 @@ package hs.fulda.de.ci.exam.project;
import org.junit.jupiter.api.*;
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.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -44,10 +49,23 @@ public class AccountTest {
}
@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(){
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, () -> {
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");
}
}
Loading…
Cancel
Save