-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainTestArrayStorage.java
More file actions
58 lines (46 loc) · 1.62 KB
/
Copy pathMainTestArrayStorage.java
File metadata and controls
58 lines (46 loc) · 1.62 KB
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
/**
* Test for your ArrayStorage implementation
*/
public class MainTestArrayStorage {
static final ArrayStorage ARRAY_STORAGE = new ArrayStorage();
static int ARRAY_STORAGE_LIMIT = 10_000;
public static void main(String[] args) {
Resume r1 = new Resume();
r1.setUuid("uuid1");
Resume r2 = new Resume();
r2.setUuid("uuid2");
Resume r3 = new Resume();
r3.setUuid("uuid3");
Resume r2new = new Resume();
r2new.setUuid("uuid2");
ARRAY_STORAGE.save(r1);
ARRAY_STORAGE.save(r2);
ARRAY_STORAGE.save(r3);
System.out.println("Get r1: " + ARRAY_STORAGE.get(r1.getUuid()));
System.out.println("Size: " + ARRAY_STORAGE.size());
System.out.println("Get dummy: " + ARRAY_STORAGE.get("dummy"));
ARRAY_STORAGE.save(r2new);
ARRAY_STORAGE.update(r2new);
System.out.println("Get r2new: " + ARRAY_STORAGE.get(r2new.getUuid()));
ARRAY_STORAGE.get("uuid111");
ARRAY_STORAGE.delete("uuid111");
printAll();
ARRAY_STORAGE.delete(r1.getUuid());
printAll();
ARRAY_STORAGE.clear();
printAll();
System.out.println("Size: " + ARRAY_STORAGE.size());
for (int i = 0; i <= ARRAY_STORAGE_LIMIT; i++) {
Resume r = new Resume();
r.setUuid("uuid" + i);
ARRAY_STORAGE.save(r);
}
System.out.println("Size: " + ARRAY_STORAGE.size());
}
static void printAll() {
System.out.println("\nGet All");
for (Resume r : ARRAY_STORAGE.getAll()) {
System.out.println(r);
}
}
}