4848
4949@ EnableAutoWeld
5050@ AddPackages (value = {Database .class , EntityConverter .class , DocumentTemplate .class })
51- @ AddPackages (Book .class )
51+ @ AddPackages (Magazine .class )
5252@ AddPackages (ArangoDBTemplate .class )
5353@ AddExtensions ({EntityMetadataExtension .class ,
5454 DocumentExtension .class })
@@ -68,101 +68,101 @@ class ArangoDBTemplateIntegrationTest {
6868
6969 @ BeforeEach
7070 void setUp () {
71- this .template .delete (Book .class ).execute ();
71+ this .template .delete (Magazine .class ).execute ();
7272 }
7373
7474 @ Test
7575 void shouldInsert () {
76- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
77- template .insert (book );
78- Optional <Book > optional = template .find (Book .class , book .id ());
76+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
77+ template .insert (magazine );
78+ Optional <Magazine > optional = template .find (Magazine .class , magazine .id ());
7979 assertThat (optional ).isNotNull ().isNotEmpty ()
80- .get ().isEqualTo (book );
80+ .get ().isEqualTo (magazine );
8181 }
8282
8383 @ Test
8484 void shouldUpdate () {
85- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
86- assertThat (template .insert (book ))
85+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
86+ assertThat (template .insert (magazine ))
8787 .isNotNull ()
88- .isEqualTo (book );
88+ .isEqualTo (magazine );
8989
90- Book updated = new Book ( book .id (), book .title () + " updated" , 2 );
90+ Magazine updated = new Magazine ( magazine .id (), magazine .title () + " updated" , 2 );
9191
9292 assertThat (template .update (updated ))
9393 .isNotNull ()
94- .isNotEqualTo (book );
94+ .isNotEqualTo (magazine );
9595
96- assertThat (template .find (Book .class , book .id ()))
96+ assertThat (template .find (Magazine .class , magazine .id ()))
9797 .isNotNull ().get ().isEqualTo (updated );
9898
9999 }
100100
101101 @ Test
102102 void shouldFindById () {
103- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
104- assertThat (template .insert (book ))
103+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
104+ assertThat (template .insert (magazine ))
105105 .isNotNull ()
106- .isEqualTo (book );
106+ .isEqualTo (magazine );
107107
108- assertThat (template .find (Book .class , book .id ()))
109- .isNotNull ().get ().isEqualTo (book );
108+ assertThat (template .find (Magazine .class , magazine .id ()))
109+ .isNotNull ().get ().isEqualTo (magazine );
110110 }
111111
112112 @ Test
113113 void shouldDelete () {
114- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
115- assertThat (template .insert (book ))
114+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
115+ assertThat (template .insert (magazine ))
116116 .isNotNull ()
117- .isEqualTo (book );
117+ .isEqualTo (magazine );
118118
119- template .delete (Book .class , book .id ());
120- assertThat (template .find (Book .class , book .id ()))
119+ template .delete (Magazine .class , magazine .id ());
120+ assertThat (template .find (Magazine .class , magazine .id ()))
121121 .isNotNull ().isEmpty ();
122122 }
123123
124124 @ Test
125125 void shouldDeleteAll () {
126126 for (int index = 0 ; index < 20 ; index ++) {
127- Book book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
128- assertThat (template .insert (book ))
127+ Magazine magazine = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
128+ assertThat (template .insert (magazine ))
129129 .isNotNull ()
130- .isEqualTo (book );
130+ .isEqualTo (magazine );
131131 }
132132
133- template .delete (Book .class ).execute ();
134- assertThat (template .select (Book .class ).result ()).isEmpty ();
133+ template .delete (Magazine .class ).execute ();
134+ assertThat (template .select (Magazine .class ).result ()).isEmpty ();
135135 }
136136
137137
138138 @ Test
139139 void shouldUpdateNullValues () {
140- var book = new Book (randomUUID ().toString (), "Effective Java" , 1 );
140+ var book = new Magazine (randomUUID ().toString (), "Effective Java" , 1 );
141141 template .insert (book );
142- template .update (new Book (book .id (), null , 2 ));
143- Optional <Book > optional = template .select (Book .class ).where ("id" )
142+ template .update (new Magazine (book .id (), null , 2 ));
143+ Optional <Magazine > optional = template .select (Magazine .class ).where ("id" )
144144 .eq (book .id ()).singleResult ();
145145 SoftAssertions .assertSoftly (softly -> {
146146 softly .assertThat (optional ).isPresent ();
147- softly .assertThat (optional ).get ().extracting (Book ::title ).isNull ();
148- softly .assertThat (optional ).get ().extracting (Book ::edition ).isEqualTo (2 );
147+ softly .assertThat (optional ).get ().extracting (Magazine ::title ).isNull ();
148+ softly .assertThat (optional ).get ().extracting (Magazine ::edition ).isEqualTo (2 );
149149 });
150150 }
151151
152152 @ Test
153153 void shouldExecuteLimit () {
154154
155155 for (int index = 1 ; index < 10 ; index ++) {
156- var book = new Book (randomUUID ().toString (), "Effective Java" , index );
156+ var book = new Magazine (randomUUID ().toString (), "Effective Java" , index );
157157 template .insert (book );
158158 }
159159
160- List <Book > books = template .select (Book .class ).orderBy ("edition" )
160+ List <Magazine > magazines = template .select (Magazine .class ).orderBy ("edition" )
161161 .asc ().limit (4 ).result ();
162162
163163 SoftAssertions .assertSoftly (soft -> {
164- soft .assertThat (books ).hasSize (4 );
165- var editions = books .stream ().map (Book ::edition ).toList ();
164+ soft .assertThat (magazines ).hasSize (4 );
165+ var editions = magazines .stream ().map (Magazine ::edition ).toList ();
166166 soft .assertThat (editions ).hasSize (4 ).contains (1 , 2 , 3 , 4 );
167167 });
168168
@@ -171,52 +171,52 @@ void shouldExecuteLimit() {
171171 @ Test
172172 void shouldExecuteSkip () {
173173 for (int index = 1 ; index < 10 ; index ++) {
174- var book = new Book (randomUUID ().toString (), "Effective Java" , index );
174+ var book = new Magazine (randomUUID ().toString (), "Effective Java" , index );
175175 template .insert (book );
176176 }
177177
178- List <Book > books = template .select (Book .class ).orderBy ("edition" )
178+ List <Magazine > magazines = template .select (Magazine .class ).orderBy ("edition" )
179179 .asc ().skip (4 ).result ();
180180
181181 SoftAssertions .assertSoftly (soft -> {
182- soft .assertThat (books ).hasSize (5 );
183- var editions = books .stream ().map (Book ::edition ).toList ();
182+ soft .assertThat (magazines ).hasSize (5 );
183+ var editions = magazines .stream ().map (Magazine ::edition ).toList ();
184184 soft .assertThat (editions ).hasSize (5 ).contains (5 , 6 , 7 , 8 , 9 );
185185 });
186186 }
187187
188188 @ Test
189189 void shouldExecuteLimitStart () {
190190 for (int index = 1 ; index < 10 ; index ++) {
191- var book = new Book (randomUUID ().toString (), "Effective Java" , index );
191+ var book = new Magazine (randomUUID ().toString (), "Effective Java" , index );
192192 template .insert (book );
193193 }
194194
195- List <Book > books = template .select (Book .class ).orderBy ("edition" )
195+ List <Magazine > magazines = template .select (Magazine .class ).orderBy ("edition" )
196196 .asc ().skip (4 ).limit (3 ).result ();
197197
198198 SoftAssertions .assertSoftly (soft -> {
199- soft .assertThat (books ).hasSize (3 );
200- var editions = books .stream ().map (Book ::edition ).toList ();
199+ soft .assertThat (magazines ).hasSize (3 );
200+ var editions = magazines .stream ().map (Magazine ::edition ).toList ();
201201 soft .assertThat (editions ).hasSize (3 ).contains (5 , 6 , 7 );
202202 });
203203 }
204204
205205 @ Test
206206 void shouldSelectCursorSize () {
207207 for (int index = 1 ; index < 10 ; index ++) {
208- var book = new Book (randomUUID ().toString (), "Effective Java" , index );
208+ var book = new Magazine (randomUUID ().toString (), "Effective Java" , index );
209209 template .insert (book );
210210 }
211211 var select = SelectQuery .select ().from ("Book" ).orderBy ("edition" ).asc ()
212212 .skip (4 ).limit (3 ).build ();
213213 var pageRequest = PageRequest .ofSize (3 );
214- CursoredPage <Book > entities = template .selectCursor (select , pageRequest );
214+ CursoredPage <Magazine > entities = template .selectCursor (select , pageRequest );
215215
216216 SoftAssertions .assertSoftly (soft -> {
217217 var content = entities .content ();
218218 soft .assertThat (content ).hasSize (3 );
219- var editions = content .stream ().map (Book ::edition ).toList ();
219+ var editions = content .stream ().map (Magazine ::edition ).toList ();
220220 soft .assertThat (editions ).hasSize (3 ).contains (1 , 2 , 3 );
221221 });
222222 }
0 commit comments