Skip to content
Snippets Groups Projects
Commit 9d5a2b57 authored by zabiulla.ahmadi's avatar zabiulla.ahmadi
Browse files

4 partie test delete

parent c53aa7a7
No related branches found
No related tags found
No related merge requests found
Pipeline #23690 passed
...@@ -18,7 +18,6 @@ import javafx.scene.control.Alert.AlertType; ...@@ -18,7 +18,6 @@ import javafx.scene.control.Alert.AlertType;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import java.awt.image.BufferedImage;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -27,8 +26,6 @@ import java.util.function.Predicate; ...@@ -27,8 +26,6 @@ import java.util.function.Predicate;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.management.relation.Relation;
public class MainController implements Initializable { public class MainController implements Initializable {
Application app = new Application(); Application app = new Application();
......
...@@ -108,4 +108,32 @@ public class MainTest { ...@@ -108,4 +108,32 @@ public class MainTest {
assertEquals(app.getContactList().get(0).getName(), name2); assertEquals(app.getContactList().get(0).getName(), name2);
} }
@Test
public void testDelete() {
String name = "alex";
List<String> lastName = List.of("kurteshi", "browman");
String address = "rue du rhone 4, 1203 Genève";
List<String> telephoneNumber = List.of("+41 77 444 33 22");
List<String> email = List.of("alex@gmail.com");
List<String> socialAcount = List.of("https://hello.com/?name=alex");
String profession = "student";
String relation = "close freind";
Contacts contact1 = new Friend(name, lastName, "Friend", relation, address, telephoneNumber, email, socialAcount,
profession);
int sizeBeforeDelete = app.getContactList().size();
app.addToContactList(contact1);
app.delete(name);
assertEquals(app.getContactList().size(), sizeBeforeDelete);
Optional<Contacts> exists = app.getContactList().stream().filter(contact -> contact.getName() == name).findFirst();
assertEquals(contact1, exists.get());
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment