use of EmployeeDefs.AEmployeeException.InvalidParameter in project SmartCity-Market by TechnionYP5777.
the class ManageCatalogProductDetailsTab method renameIngrPressed.
void renameIngrPressed() {
long id = ingredients.get(selectedIngr.iterator().next()).getId();
try {
manager.editIngredient(new Ingredient(id, renameIngrLbl.getText()));
} catch (InvalidParameter | CriticalError | EmployeeNotConnected | ConnectionFailure | ParamIDDoesNotExist e) {
log.debug(StackTraceUtil.getStackTrace(e));
log.fatal(e);
e.showInfoToUser();
}
selectedIngr.clear();
createIngredientList();
enableButtons();
enableAddButtons();
}
use of EmployeeDefs.AEmployeeException.InvalidParameter in project SmartCity-Market by TechnionYP5777.
the class ManageCatalogProductDetailsTab method addManuPressed.
void addManuPressed() {
try {
manager.addManufacturer(new Manufacturer(0, newManu.getText()));
} catch (InvalidParameter | CriticalError | EmployeeNotConnected | ConnectionFailure | ParamIDAlreadyExists e) {
log.fatal(e);
log.debug(StackTraceUtil.getStackTrace(e));
e.showInfoToUser();
}
selectedManu.clear();
createManufacturerList();
enableButtons();
enableAddButtons();
}
use of EmployeeDefs.AEmployeeException.InvalidParameter in project SmartCity-Market by TechnionYP5777.
the class ViewProductFromCatalogTest method ViewProductFromCatalogSuccessfulTest.
@Test
public void ViewProductFromCatalogSuccessfulTest() {
CatalogProduct testCatalogProduct = null, catalogProduct = new CatalogProduct(1234567890, "name", null, new Manufacturer(1, "Manufacturer"), "description", 22.0, null, null);
CommandWrapper commandWrapper = new CommandWrapper(ResultDescriptor.SM_OK, Serialization.serialize(catalogProduct));
try {
Mockito.when(clientRequestHandler.sendRequestWithRespond(new CommandWrapper(WorkerDefs.loginCommandSenderId, CommandDescriptor.VIEW_PRODUCT_FROM_CATALOG, Serialization.serialize(new SmartCode(1234567890, null))).serialize())).thenReturn(commandWrapper.serialize());
} catch (IOException ¢) {
fail();
}
try {
testCatalogProduct = worker.viewProductFromCatalog(1234567890);
} catch (InvalidParameter | CriticalError | EmployeeNotConnected | ProductNotExistInCatalog | ConnectionFailure ¢) {
fail();
}
assertEquals(testCatalogProduct.getBarcode(), 1234567890);
assertEquals(testCatalogProduct.getManufacturer().getId(), 1);
assertEquals(testCatalogProduct.getManufacturer().getName(), "Manufacturer");
assertEquals(testCatalogProduct.getName(), "name");
}
Aggregations