private void compareDept(Staff staff, int restaurantId) throws SQLException, BusinessException { for (Department dept : DepartmentDao.getByCond( staff, new DepartmentDao.ExtraCond() .addType(Department.Type.NORMAL) .addType(Department.Type.IDLE), null)) { Kitchen feastKitchen = KitchenDao.getByCond( staff, new KitchenDao.ExtraCond().setDeptId(dept.getId()).setType(Kitchen.Type.FEAST), null) .get(0); Assert.assertEquals( "restaurant : associated feast kitchen", staff.getRestaurantId(), feastKitchen.getRestaurantId()); Assert.assertEquals( "name : associated feast kitchen", dept.getName() + "酒席费", feastKitchen.getName()); Assert.assertEquals("display : associated feast kitchen", 0, feastKitchen.getDisplayId()); } Department deptToTemp = DepartmentDao.getByType(staff, Department.Type.TEMP).get(0); Assert.assertEquals("department id", deptToTemp.getId(), Department.DeptId.DEPT_TMP.getVal()); Assert.assertEquals( "department name", deptToTemp.getName(), Department.DeptId.DEPT_TMP.getDesc()); Assert.assertEquals( "department associated restaurant id", deptToTemp.getRestaurantId(), restaurantId); Assert.assertEquals("department type", deptToTemp.getType(), Department.Type.TEMP); Assert.assertEquals("display id", deptToTemp.getDisplayId(), 0); Department deptToNull = DepartmentDao.getByType(staff, Department.Type.NULL).get(0); Assert.assertEquals("department id", deptToNull.getId(), Department.DeptId.DEPT_NULL.getVal()); Assert.assertEquals( "department name", deptToNull.getName(), Department.DeptId.DEPT_NULL.getDesc()); Assert.assertEquals( "department associated restaurant id", deptToNull.getRestaurantId(), restaurantId); Assert.assertEquals("department type", deptToNull.getType(), Department.Type.NULL); Assert.assertEquals("display id", deptToNull.getDisplayId(), 0); Department deptToWare = DepartmentDao.getByType(staff, Department.Type.WARE_HOUSE).get(0); Assert.assertEquals( "department id", deptToWare.getId(), Department.DeptId.DEPT_WAREHOUSE.getVal()); Assert.assertEquals( "department name", deptToWare.getName(), Department.DeptId.DEPT_WAREHOUSE.getDesc()); Assert.assertEquals( "department associated restaurant id", deptToNull.getRestaurantId(), restaurantId); Assert.assertEquals("department type", deptToWare.getType(), Department.Type.WARE_HOUSE); Assert.assertEquals("display id", deptToWare.getDisplayId(), 0); }
private void compareKitchens(Staff staff, int restaurantId) throws SQLException { Kitchen kitchenToNull = KitchenDao.getByType(staff, Kitchen.Type.NULL).get(0); Assert.assertEquals( "deptId to kitchen", kitchenToNull.getDept().getId(), Department.DeptId.DEPT_NULL.getVal()); Assert.assertEquals("kitchen name", kitchenToNull.getName(), "空厨房"); Assert.assertEquals("kitchen type", kitchenToNull.getType(), Kitchen.Type.NULL); Assert.assertEquals( "kitchen associated restaurant", kitchenToNull.getRestaurantId(), restaurantId); Assert.assertEquals("display id", kitchenToNull.getDisplayId(), 0); Kitchen kitchenToTemp = KitchenDao.getByType(staff, Kitchen.Type.TEMP).get(0); Assert.assertEquals( "deptId to kitchen", kitchenToTemp.getDept().getId(), Department.DeptId.DEPT_TMP.getVal()); Assert.assertEquals("kitchen name", kitchenToTemp.getName(), "临时厨房"); Assert.assertEquals("kitchen type", kitchenToTemp.getType(), Kitchen.Type.TEMP); Assert.assertEquals( "kitchen associated restaurant", kitchenToTemp.getRestaurantId(), restaurantId); Assert.assertEquals("display id", kitchenToTemp.getDisplayId(), 0); }