11package com .baeldung .orientdb ;
22
33import com .orientechnologies .orient .core .db .document .ODatabaseDocumentTx ;
4- import com .orientechnologies .orient .core .exception .OSchemaException ;
5- import com .orientechnologies .orient .core .metadata .schema .OType ;
64import com .orientechnologies .orient .core .record .impl .ODocument ;
75import com .orientechnologies .orient .core .sql .query .OSQLSynchQuery ;
8- import com .tinkerpop .blueprints .Vertex ;
9- import com .tinkerpop .blueprints .impls .orient .OrientGraphNoTx ;
10- import com .tinkerpop .blueprints .impls .orient .OrientVertexType ;
11- import org .junit .*;
6+ import org .junit .AfterClass ;
7+ import org .junit .BeforeClass ;
8+ import org .junit .Test ;
129
1310import java .util .List ;
1411
1512import static junit .framework .Assert .assertEquals ;
16- import static junit .framework .Assert .assertNotNull ;
17- import static org .junit .Assert .assertNotEquals ;
1813
1914public class OrientDBDocumentAPITest {
2015 private static ODatabaseDocumentTx db = null ;
@@ -28,32 +23,32 @@ public static void setup() {
2823 @ Test
2924 public void givenDB_whenSavingDocument_thenClassIsAutoCreated () {
3025 ODocument author = new ODocument ("Author" );
31- author .field ( "firstName" , "Paul" );
32- author .field ( "lastName" , "Smith" );
33- author .field ( "country" , "USA" );
34- author .field ( "publicProfile" , false );
35- author .field ( "level" , 7 );
26+ author .field ("firstName" , "Paul" );
27+ author .field ("lastName" , "Smith" );
28+ author .field ("country" , "USA" );
29+ author .field ("publicProfile" , false );
30+ author .field ("level" , 7 );
3631 author .save ();
3732
3833 assertEquals ("Author" , author .getSchemaClass ().getName ());
3934 }
4035
4136 @ Test
42- public void givenAnEmptyDB_afterSavingTwoAuthors_thenWeGetAuthorsWithLevelSeven () {
37+ public void givenDB_whenSavingAuthors_thenWeGetOnesWithLevelSeven () {
4338 for (ODocument author : db .browseClass ("Author" )) author .delete ();
4439
4540 ODocument authorOne = new ODocument ("Author" );
46- authorOne .field ( "firstName" , "Leo" );
47- authorOne .field ( "level" , 7 );
41+ authorOne .field ("firstName" , "Leo" );
42+ authorOne .field ("level" , 7 );
4843 authorOne .save ();
4944
5045 ODocument authorTwo = new ODocument ("Author" );
51- authorTwo .field ( "firstName" , "Lucien" );
52- authorTwo .field ( "level" , 9 );
46+ authorTwo .field ("firstName" , "Lucien" );
47+ authorTwo .field ("level" , 9 );
5348 authorTwo .save ();
5449
5550 List <ODocument > result = db .query (
56- new OSQLSynchQuery <ODocument >("select * from Author where level = 7" ));
51+ new OSQLSynchQuery <ODocument >("select * from Author where level = 7" ));
5752
5853 assertEquals (1 , result .size ());
5954 }
0 commit comments