-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainTestArrayStorage.java
More file actions
49 lines (40 loc) · 1.47 KB
/
MainTestArrayStorage.java
File metadata and controls
49 lines (40 loc) · 1.47 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
package ru.javaops.webapp;
import ru.javaops.webapp.model.Resume;
import ru.javaops.webapp.storage.SortedArrayStorage;
import ru.javaops.webapp.storage.Storage;
/**
* Test for your ru.javaops.webapp.storage.ArrayStorage implementation
*/
public class MainTestArrayStorage {
// static final Storage ARRAY_STORAGE = new ArrayStorage();
static final Storage ARRAY_STORAGE = new SortedArrayStorage();
public static void main(String[] args) {
Resume r1 = new Resume("uuid1");
Resume r2 = new Resume("uuid2");
Resume r3 = new Resume("uuid3");
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());
Resume r4 = new Resume("uuid3");
Resume r5 = new Resume("dummy");
System.out.println("Update uuid3");
ARRAY_STORAGE.update(r4);
System.out.println("Update dummy");
ARRAY_STORAGE.update(r5);
System.out.println("Get dummy: " + ARRAY_STORAGE.get("dummy"));
printAll();
ARRAY_STORAGE.delete(r1.getUuid());
printAll();
ARRAY_STORAGE.clear();
printAll();
System.out.println("Size: " + ARRAY_STORAGE.size());
}
static void printAll() {
System.out.println("\nGet All");
for (Resume r : ARRAY_STORAGE.getAllSorted()) {
System.out.println(r);
}
}
}