use of SQLDatabase.SQLDatabaseException.ManufacturerNotExist in project SmartCity-Market by TechnionYP5777.
the class EditProductFromCatalogTest method editCatalogProductInvalidParamTest.
@Test
public void editCatalogProductInvalidParamTest() {
int senderID = 1;
CatalogProduct catalogProduct = new CatalogProduct(0, "Shoko", null, null, null, -1, null, null);
String command = new CommandWrapper(senderID, CommandDescriptor.EDIT_PRODUCT_FROM_CATALOG, new Gson().toJson(catalogProduct, CatalogProduct.class)).serialize();
CommandExecuter commandExecuter = new CommandExecuter(command);
CommandWrapper out;
try {
Mockito.doNothing().when(sqlDatabaseConnection).editProductInCatalog(senderID, catalogProduct);
} catch (CriticalError | ClientNotConnected | ProductNotExistInCatalog | IngredientNotExist | ManufacturerNotExist e) {
fail();
}
out = commandExecuter.execute(sqlDatabaseConnection);
assertEquals(ResultDescriptor.SM_INVALID_PARAMETER, out.getResultDescriptor());
}
Aggregations