forked from nus-cs2103-AY1819S1/addressbook-level4
-
Notifications
You must be signed in to change notification settings - Fork 4
/
TypicalItems.java
120 lines (103 loc) · 5.61 KB
/
TypicalItems.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package seedu.inventory.testutil;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_IMAGE_OPPO;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_IMAGE_SONY;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_NAME_OPPO;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_NAME_SONY;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_PRICE_OPPO;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_PRICE_SONY;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_QUANTITY_OPPO;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_QUANTITY_SONY;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_SKU_OPPO;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_SKU_SONY;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_TAG_GADGET;
import static seedu.inventory.logic.commands.CommandTestUtil.VALID_TAG_SMARTPHONE;
import static seedu.inventory.testutil.purchaseorder.TypicalPurchaseOrder.getTypicalPurchaseOrder;
import static seedu.inventory.testutil.staff.TypicalStaffs.getTypicalStaffList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import seedu.inventory.model.Inventory;
import seedu.inventory.model.item.Item;
/**
* A utility class containing a list of {@code Item} objects to be used in tests.
*/
public class TypicalItems {
public static final Item IPHONE = new ItemBuilder().withName("iPhone XR")
.withPrice("1500.00").withImage("docs/images/iphone.jpg").withSku("apple-iphone-xr")
.withQuantity("30").withTags("apple").build();
public static final Item GOOGLE = new ItemBuilder().withName("Google Pixel XL").withPrice("1459.99")
.withQuantity("3").withSku("google-pixel-xl").withImage("docs/images/google.jpg").build();
public static final Item LG = new ItemBuilder().withName("LG G7").withPrice("1099.00").withQuantity("20")
.withSku("lg-g7").withImage("docs/images/lg.jpg").withTags("smartphone").build();
public static final Item SAMSUNGNOTE = new ItemBuilder().withName("Samsung Note 9").withPrice("1590.00")
.withQuantity("1000").withSku("samsung-note-9").withImage("docs/images/huawei.jpg").build();
public static final Item ONEPLUS = new ItemBuilder().withName("OnePlus 6").withPrice("1234.56").withQuantity("10")
.withSku("oneplus-6").withImage("docs/images/oneplus.jpg").build();
public static final Item HTC = new ItemBuilder().withName("HTC U6").withPrice("980.00").withQuantity("75")
.withSku("htc-u6").withImage("docs/images/htc.jpg").build();
public static final Item SAMSUNG = new ItemBuilder().withName("Samsung S9").withPrice("1299.99")
.withImage("docs/images/samsung.jpg").withSku("samsung-s9").withQuantity("100")
.withTags("samsung", "smartphone").build();
// Manually added
public static final Item NOKIA = new ItemBuilder().withName("Nokia 3310").withQuantity("900")
.withSku("nokia-3310").withImage("docs/images/nokia.jpg").build();
public static final Item XIAOMI = new ItemBuilder().withName("XIAOMI MI 8").withQuantity("50")
.withSku("xiaomi-mi-8").withImage("docs/images/xiaomi.jpg").build();
// Manually added - Item's details found in {@code CommandTestUtil}
public static final Item OPPO = new ItemBuilder().withName(VALID_NAME_OPPO).withPrice(VALID_PRICE_OPPO)
.withQuantity(VALID_QUANTITY_OPPO).withSku(VALID_SKU_OPPO).withImage(VALID_IMAGE_OPPO)
.withTags(VALID_TAG_GADGET).build();
public static final Item SONY = new ItemBuilder().withName(VALID_NAME_SONY).withPrice(VALID_PRICE_SONY)
.withQuantity(VALID_QUANTITY_SONY).withSku(VALID_SKU_SONY).withImage(VALID_IMAGE_SONY)
.withTags(VALID_TAG_SMARTPHONE, VALID_TAG_GADGET).build();
public static final String KEYWORD_MATCHING_SAMSUNG = "Samsung"; // A keyword that matches SAMSUNG
public static final String FILTER_CONDITIONS_MATCHING_SAMSUNG =
"p/>1200 q/>100"; // Filter conditions that match SAMSUNG
private TypicalItems() {
} // prevents instantiation
/**
* Returns an {@code Inventory} with all the typical items and purchase orders.
*/
public static Inventory getTypicalInventory() {
Inventory inventory = new Inventory();
for (Item item : getTypicalItems()) {
inventory.addItem(item);
}
return inventory;
}
/**
* Returns an {@code Inventory} with low quantities
*/
public static Inventory getLowQuantityInventory() {
Inventory inventory = new Inventory();
for (Item item : getTypicalItems()) {
if (Integer.parseInt(item.getQuantity().value) <= 10) {
inventory.addItem(item);
}
}
return inventory;
}
/**
* Returns an {@code Inventory} with all the typical items and staffs.
*
* @return
*/
public static Inventory getTypicalInventoryWithStaff() {
Inventory inventory = getTypicalInventory();
inventory.resetData(getTypicalStaffList());
return inventory;
}
/**
* Returns an {@code Inventory} with all the typical items and purchase order.
*
* @return
*/
public static Inventory getTypicalInventoryWithPo() {
Inventory inventory = getTypicalInventory();
inventory.setPurchaseOrders(getTypicalPurchaseOrder());
return inventory;
}
public static List<Item> getTypicalItems() {
return new ArrayList<>(Arrays.asList(IPHONE, GOOGLE, LG, SAMSUNGNOTE, ONEPLUS, HTC, SAMSUNG));
}
}