forked from JavaOPs/basejava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainTestSortedArrayStorage.java
More file actions
57 lines (47 loc) · 1.63 KB
/
MainTestSortedArrayStorage.java
File metadata and controls
57 lines (47 loc) · 1.63 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
import model.Resume;
import storage.SortedArrayStorage;
import storage.Storage;
/**
* Test for your resumes.ArrayStorage implementation
*/
public class MainTestSortedArrayStorage {
private static final Storage SORTED_ARRAY_STORAGE = new SortedArrayStorage();
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 r4 = new Resume();
r4.setUuid("uuid4");
Resume r5 = new Resume();
r5.setUuid("uuid5");
SORTED_ARRAY_STORAGE.save(r4);
SORTED_ARRAY_STORAGE.save(r1);
SORTED_ARRAY_STORAGE.save(r3);
SORTED_ARRAY_STORAGE.save(r2);
SORTED_ARRAY_STORAGE.save(r5);
printAll();
System.out.println("Get r1: " + SORTED_ARRAY_STORAGE.get(r1.getUuid()));
System.out.println("Size: " + SORTED_ARRAY_STORAGE.size());
System.out.println("Get dummy: " + SORTED_ARRAY_STORAGE.get("dummy"));
printAll();
System.out.println("Delete r1");
SORTED_ARRAY_STORAGE.delete(r1.getUuid());
printAll();
System.out.println("Update r3");
SORTED_ARRAY_STORAGE.update(r3);
printAll();
System.out.println("Clear All");
SORTED_ARRAY_STORAGE.clear();
printAll();
System.out.println("Size: " + SORTED_ARRAY_STORAGE.size());
}
private static void printAll() {
System.out.println("\nGet All");
for (Resume r : SORTED_ARRAY_STORAGE.getAll()) {
System.out.println(r);
}
}
}