Search in sources :

Example 61 with SQLDatabaseConnection

use of SQLDatabase.SQLDatabaseConnection in project SmartCity-Market by TechnionYP5777.

the class SQLDatabaseConnectionTest method testCantGetSecurityQusetionOfNotExistedCustomer.

@Test
public void testCantGetSecurityQusetionOfNotExistedCustomer() {
    SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
    try {
        sqlConnection.getSecurityQuestionCustomer(customerName);
        fail();
    } catch (CriticalError e1) {
        fail();
    } catch (ClientNotExist e2) {
    }
}
Also used : SQLDatabaseConnection(SQLDatabase.SQLDatabaseConnection) CriticalError(SQLDatabase.SQLDatabaseException.CriticalError) ClientNotExist(SQLDatabase.SQLDatabaseException.ClientNotExist) Test(org.junit.Test)

Example 62 with SQLDatabaseConnection

use of SQLDatabase.SQLDatabaseConnection in project SmartCity-Market by TechnionYP5777.

the class SQLDatabaseConnectionTest method testRemoveNotExistedPakageFromWarehouse.

@Test
public void testRemoveNotExistedPakageFromWarehouse() {
    SQLDatabaseConnection sqlConnection = new SQLDatabaseConnection();
    ProductPackage productPackage = new ProductPackage(new SmartCode(barcodeDebug, date112000), 10, locationWarehouse);
    try {
        sqlConnection.removeProductPackageFromWarehouse(null, productPackage);
        fail();
    } catch (ProductPackageNotExist e) {
    } catch (CriticalError | ClientNotConnected | ProductNotExistInCatalog | ProductPackageAmountNotMatch e) {
        fail();
    }
}
Also used : SmartCode(BasicCommonClasses.SmartCode) ProductNotExistInCatalog(SQLDatabase.SQLDatabaseException.ProductNotExistInCatalog) ProductPackageAmountNotMatch(SQLDatabase.SQLDatabaseException.ProductPackageAmountNotMatch) SQLDatabaseConnection(SQLDatabase.SQLDatabaseConnection) CriticalError(SQLDatabase.SQLDatabaseException.CriticalError) ClientNotConnected(SQLDatabase.SQLDatabaseException.ClientNotConnected) ProductPackage(BasicCommonClasses.ProductPackage) ProductPackageNotExist(SQLDatabase.SQLDatabaseException.ProductPackageNotExist) Test(org.junit.Test)

Aggregations

SQLDatabaseConnection (SQLDatabase.SQLDatabaseConnection)62 CriticalError (SQLDatabase.SQLDatabaseException.CriticalError)61 Test (org.junit.Test)58 ClientNotConnected (SQLDatabase.SQLDatabaseException.ClientNotConnected)48 ProductNotExistInCatalog (SQLDatabase.SQLDatabaseException.ProductNotExistInCatalog)24 SmartCode (BasicCommonClasses.SmartCode)20 AuthenticationError (SQLDatabase.SQLDatabaseException.AuthenticationError)19 ClientAlreadyConnected (SQLDatabase.SQLDatabaseException.ClientAlreadyConnected)19 NumberOfConnectionsExceeded (SQLDatabase.SQLDatabaseException.NumberOfConnectionsExceeded)19 ProductPackage (BasicCommonClasses.ProductPackage)18 ClientNotExist (SQLDatabase.SQLDatabaseException.ClientNotExist)17 ProductPackageAmountNotMatch (SQLDatabase.SQLDatabaseException.ProductPackageAmountNotMatch)16 ProductPackageNotExist (SQLDatabase.SQLDatabaseException.ProductPackageNotExist)16 ForgotPasswordData (BasicCommonClasses.ForgotPasswordData)9 Manufacturer (BasicCommonClasses.Manufacturer)9 Ingredient (BasicCommonClasses.Ingredient)8 ClientAlreadyExist (SQLDatabase.SQLDatabaseException.ClientAlreadyExist)8 IngredientNotExist (SQLDatabase.SQLDatabaseException.IngredientNotExist)6 Gson (com.google.gson.Gson)6 CatalogProduct (BasicCommonClasses.CatalogProduct)5