-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContactServiceTest.java
More file actions
30 lines (27 loc) · 1.09 KB
/
ContactServiceTest.java
File metadata and controls
30 lines (27 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class ContactServiceTest {
@Test
public void testAddContact() {
ContactService service = new ContactService();
Contact contact = new Contact("12345", "John", "Doe", "1234567890", "123 Elm St");
service.addContact(contact);
assertEquals(contact, service.getContact("12345"));
}
@Test
public void testDeleteContact() {
ContactService service = new ContactService();
Contact contact = new Contact("12345", "John", "Doe", "1234567890", "123 Elm St");
service.addContact(contact);
service.deleteContact("12345");
assertNull(service.getContact("12345"));
}
@Test
public void testUpdateContact() {
ContactService service = new ContactService();
Contact contact = new Contact("12345", "John", "Doe", "1234567890", "123 Elm St");
service.addContact(contact);
service.updateContact("12345", "Jane", null, null, null);
assertEquals("Jane", service.getContact("12345").getFirstName());
}
}