String contact = "";
ContactController instance = new ContactController();
// --- Tests incorrects cases (return null)
Contact expResult = null;
//test empty string
Contact result = instance.parse(contact);
assertEquals("Parsing empty string should give a null contact",
expResult, result);
// test null string
contact = null;
result = instance.parse(contact);
assertEquals("Parsing null string should give a null contact",
expResult, result);
// test incorrect number
contact = "[199999999]"; //this case can't occur until few thousand of years
result = instance.parse(contact);
assertEquals("Parsing incorrect number should give a null contact",
expResult, result);
// test incorrect format number
contact = "[1Z1]";
result = instance.parse(contact);
assertEquals("Parsing invalid format number should give a null contact",
expResult, result);
// --- Test correct case
// test correct number
expResult = new Contact();
expResult.setNote("Test case");
instance.create(expResult);
contact = "[" + expResult.getIdContact().toString() + "]";
result = instance.parse(contact);
assertEquals("Parsing empty string should give a null contact",