use of BasicCommonClasses.CustomerProfile in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnectionTest method testCustomerCanSetProfile.
@Test
public void testCustomerCanSetProfile() {
SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
CustomerProfile p = new CustomerProfile(customerName, customerName, "name", "last", "number", "email", "city", "street", date112000, new HashSet<>(), new ForgotPasswordData("question", "answer"));
CustomerProfile result = null;
try {
sqlConnection.registerCustomer(customerName, customerName);
} catch (CriticalError | ClientAlreadyExist e) {
fail();
}
try {
sqlConnection.setCustomerProfile(customerName, p);
result = Serialization.deserialize(sqlConnection.getCustomerProfile(customerName), CustomerProfile.class);
} catch (CriticalError | ClientNotExist | IngredientNotExist e1) {
fail();
} finally {
try {
sqlConnection.removeCustomer(customerName);
} catch (CriticalError | ClientNotExist e) {
e.printStackTrace();
}
}
assertEquals(p.getBirthdate(), result.getBirthdate());
assertEquals(p.getCity(), result.getCity());
assertEquals(p.getEmailAddress(), result.getEmailAddress());
assertEquals(p.getFirstName(), result.getFirstName());
assertEquals(p.getLastName(), result.getLastName());
assertEquals(p.getPhoneNumber(), result.getPhoneNumber());
assertEquals(p.getStreet(), result.getStreet());
assertEquals(p.getUserName(), result.getUserName());
}
use of BasicCommonClasses.CustomerProfile in project SmartCity-Market by TechnionYP5777.
the class SQLDatabaseConnectionTest method testCantSetProfileToNotExistedCustomer.
@Test
public void testCantSetProfileToNotExistedCustomer() {
SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
CustomerProfile p = new CustomerProfile(customerName, customerName, "name", "last", "number", "email", "city", "street", date112000, new HashSet<>(), new ForgotPasswordData("question", "answer"));
try {
sqlConnection.setCustomerProfile(customerName, p);
fail();
} catch (CriticalError | IngredientNotExist e1) {
fail();
} catch (ClientNotExist e2) {
}
}
Aggregations