4242
4343@ EnableAutoWeld
4444@ AddPackages (value = {Database .class , EntityConverter .class , DocumentTemplate .class })
45- @ AddPackages (Book .class )
45+ @ AddPackages (Magazine .class )
4646@ AddPackages (OracleNoSQLTemplate .class )
4747@ AddExtensions ({EntityMetadataExtension .class ,
4848 DocumentExtension .class })
@@ -61,79 +61,79 @@ class OracleNoSQLTemplateIntegrationTest {
6161
6262 @ Test
6363 void shouldInsert () {
64- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
65- template .insert (book );
66- Optional <Book > optional = template .find (Book .class , book .id ());
64+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
65+ template .insert (magazine );
66+ Optional <Magazine > optional = template .find (Magazine .class , magazine .id ());
6767 assertThat (optional ).isNotNull ().isNotEmpty ()
68- .get ().isEqualTo (book );
68+ .get ().isEqualTo (magazine );
6969 }
7070
7171 @ Test
7272 void shouldUpdate () {
73- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
74- assertThat (template .insert (book ))
73+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
74+ assertThat (template .insert (magazine ))
7575 .isNotNull ()
76- .isEqualTo (book );
76+ .isEqualTo (magazine );
7777
78- Book updated = new Book ( book .id (), book .title () + " updated" , 2 );
78+ Magazine updated = new Magazine ( magazine .id (), magazine .title () + " updated" , 2 );
7979
8080 assertThat (template .update (updated ))
8181 .isNotNull ()
82- .isNotEqualTo (book );
82+ .isNotEqualTo (magazine );
8383
84- assertThat (template .find (Book .class , book .id ()))
84+ assertThat (template .find (Magazine .class , magazine .id ()))
8585 .isNotNull ().get ().isEqualTo (updated );
8686
8787 }
8888
8989 @ Test
9090 void shouldFindById () {
91- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
92- assertThat (template .insert (book ))
91+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
92+ assertThat (template .insert (magazine ))
9393 .isNotNull ()
94- .isEqualTo (book );
94+ .isEqualTo (magazine );
9595
96- assertThat (template .find (Book .class , book .id ()))
97- .isNotNull ().get ().isEqualTo (book );
96+ assertThat (template .find (Magazine .class , magazine .id ()))
97+ .isNotNull ().get ().isEqualTo (magazine );
9898 }
9999
100100 @ Test
101101 void shouldDelete () {
102- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
103- assertThat (template .insert (book ))
102+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
103+ assertThat (template .insert (magazine ))
104104 .isNotNull ()
105- .isEqualTo (book );
105+ .isEqualTo (magazine );
106106
107- template .delete (Book .class , book .id ());
108- assertThat (template .find (Book .class , book .id ()))
107+ template .delete (Magazine .class , magazine .id ());
108+ assertThat (template .find (Magazine .class , magazine .id ()))
109109 .isNotNull ().isEmpty ();
110110 }
111111
112112 @ Test
113113 void shouldDeleteAll (){
114114 for (int index = 0 ; index < 20 ; index ++) {
115- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
116- assertThat (template .insert (book ))
115+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
116+ assertThat (template .insert (magazine ))
117117 .isNotNull ()
118- .isEqualTo (book );
118+ .isEqualTo (magazine );
119119 }
120120
121- template .delete (Book .class ).execute ();
122- assertThat (template .select (Book .class ).result ()).isEmpty ();
121+ template .delete (Magazine .class ).execute ();
122+ assertThat (template .select (Magazine .class ).result ()).isEmpty ();
123123 }
124124
125125
126126 @ Test
127127 void shouldUpdateNullValues (){
128- var book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
128+ var book = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
129129 template .insert (book );
130- template .update (new Book (book .id (), null , 2 ));
131- Optional <Book > optional = template .select (Book .class ).where ("id" )
130+ template .update (new Magazine (book .id (), null , 2 ));
131+ Optional <Magazine > optional = template .select (Magazine .class ).where ("id" )
132132 .eq (book .id ()).singleResult ();
133133 SoftAssertions .assertSoftly (softly -> {
134134 softly .assertThat (optional ).isPresent ();
135- softly .assertThat (optional ).get ().extracting (Book ::title ).isNull ();
136- softly .assertThat (optional ).get ().extracting (Book ::edition ).isEqualTo (2 );
135+ softly .assertThat (optional ).get ().extracting (Magazine ::title ).isNull ();
136+ softly .assertThat (optional ).get ().extracting (Magazine ::edition ).isEqualTo (2 );
137137 });
138138 }
139139
0 commit comments