1+ package ru .javawebinar .basejava ;
2+
3+ import ru .javawebinar .basejava .model .Resume ;
4+ import ru .javawebinar .basejava .storage .ArrayStorage ;
5+ import ru .javawebinar .basejava .storage .Storage ;
6+
17import java .io .BufferedReader ;
28import java .io .IOException ;
39import java .io .InputStreamReader ;
410
511/**
6- * Interactive test for ArrayStorage implementation
7- * (just run, no need to understand)
12+ * Test for ru.javawebinar.basejava.storage.ArrayStorage
813 */
914public class MainArray {
10- private final static ArrayStorage ARRAY_STORAGE = new ArrayStorage ();
15+ private final static Storage ARRAY_STORAGE = new ArrayStorage ();
1116
1217 public static void main (String [] args ) throws IOException {
1318 BufferedReader reader = new BufferedReader (new InputStreamReader (System .in ));
1419 Resume r ;
1520 while (true ) {
16- System .out .print ("Введите одну из команд - (list | save uuid | delete uuid | get uuid | clear | exit): " );
21+ System .out .print ("Введите одну из команд - (list | save uuid | delete uuid | get uuid | update uuid | clear | exit): " );
1722 String [] params = reader .readLine ().trim ().toLowerCase ().split (" " );
1823 if (params .length < 1 || params .length > 2 ) {
1924 System .out .println ("Неверная команда." );
@@ -32,10 +37,16 @@ public static void main(String[] args) throws IOException {
3237 break ;
3338 case "save" :
3439 r = new Resume ();
35- r .uuid = uuid ;
40+ r .setUuid ( uuid ) ;
3641 ARRAY_STORAGE .save (r );
3742 printAll ();
3843 break ;
44+ case "update" :
45+ r = new Resume ();
46+ r .setUuid (uuid );
47+ ARRAY_STORAGE .update (r );
48+ printAll ();
49+ break ;
3950 case "delete" :
4051 ARRAY_STORAGE .delete (uuid );
4152 printAll ();
@@ -68,4 +79,4 @@ static void printAll() {
6879 }
6980 System .out .println ("----------------------------" );
7081 }
71- }
82+ }
0 commit comments