Projekt

Obecné

Profil

Stáhnout (21.5 KB) Statistiky
| Větev: | Tag: | Revize:
1
package cz.zcu.kiv.backendapi.catalog;
2

    
3
import cz.zcu.kiv.backendapi.alternativename.CatalogItemName;
4
import cz.zcu.kiv.backendapi.bibliography.Bibliography;
5
import cz.zcu.kiv.backendapi.country.Country;
6
import cz.zcu.kiv.backendapi.exception.ApiRequestException;
7
import cz.zcu.kiv.backendapi.path.PathDto;
8
import cz.zcu.kiv.backendapi.type.Type;
9
import cz.zcu.kiv.backendapi.type.TypeServiceImpl;
10
import cz.zcu.kiv.backendapi.writtenform.WrittenForm;
11
import org.junit.jupiter.api.BeforeEach;
12
import org.junit.jupiter.api.Test;
13
import org.junit.jupiter.api.extension.ExtendWith;
14
import org.mockito.ArgumentCaptor;
15
import org.mockito.Mock;
16
import org.mockito.junit.jupiter.MockitoExtension;
17

    
18
import java.util.*;
19
import java.util.stream.Collectors;
20
import java.util.stream.Stream;
21

    
22
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
23
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
24
import static org.mockito.ArgumentMatchers.any;
25
import static org.mockito.ArgumentMatchers.anyString;
26
import static org.mockito.BDDMockito.given;
27
import static org.mockito.Mockito.never;
28
import static org.mockito.Mockito.verify;
29

    
30
@ExtendWith(MockitoExtension.class)
31
class CatalogItemServiceImplTest {
32

    
33
    @Mock
34
    private CatalogItemRepository catalogItemRepository;
35

    
36
    @Mock
37
    private TypeServiceImpl typeService;
38

    
39
    private CatalogItemServiceImpl underTest;
40

    
41
    @BeforeEach
42
    void setUp() {
43
        underTest = new CatalogItemServiceImpl(catalogItemRepository, typeService);
44
    }
45

    
46
    @Test
47
    void saveCatalog() {
48
        // given
49
        Type type = new Type("type");
50

    
51
        CatalogItem catalogItem = new CatalogItem();
52
        catalogItem.setName("aaacbbbbbbbaa");
53
        catalogItem.setBibliography(Stream.of(new Bibliography("bibl", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
54
        catalogItem.setTypes(Stream.of(type).collect(Collectors.toCollection(LinkedHashSet::new)));
55
        catalogItem.setAllNames(Stream.of(new CatalogItemName("altName", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
56
        catalogItem.setCountries(Stream.of(new Country("aaaabbaa", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
57
        catalogItem.setWrittenForms(Stream.of(new WrittenForm("written", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
58
        catalogItem.setCertainty(0);
59
        catalogItem.setLatitude(0.1);
60
        catalogItem.setLongitude(0.2);
61

    
62
        CatalogItem catalogItem2 = new CatalogItem();
63
        catalogItem2.setName("name");
64
        catalogItem2.setBibliography(Stream.of(new Bibliography("bibl", catalogItem2, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
65
        catalogItem2.setTypes(Stream.of(type).collect(Collectors.toCollection(LinkedHashSet::new)));
66
        catalogItem2.setAllNames(Stream.of(new CatalogItemName("aaaabbbbbbaa", catalogItem2, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
67
        catalogItem2.setCountries(Stream.of(new Country("aaaabbcccefaa", catalogItem2, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
68
        catalogItem2.setWrittenForms(Stream.of(new WrittenForm("written", catalogItem2, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
69
        catalogItem2.setCertainty(1);
70
        catalogItem2.setLatitude(1.1);
71
        catalogItem2.setLongitude(1.2);
72

    
73
        List<CatalogItem> catalog = List.of(catalogItem, catalogItem2);
74

    
75
        given(typeService.getTypeByName(anyString())).willReturn(Optional.of(type));
76

    
77
        // when
78
        underTest.saveCatalog(catalog);
79

    
80
        // then
81
        verify(typeService, never()).saveType(type);
82
        verify(catalogItemRepository).save(catalogItem);
83
        verify(catalogItemRepository).save(catalogItem2);
84
    }
85

    
86
    @Test
87
    void testSaveCatalogItem() {
88
        // given
89
        CatalogItemDto catalogItemDto = new CatalogItemDto();
90
        catalogItemDto.setName("name");
91
        catalogItemDto.setBibliography(Stream.of("bibl").collect(Collectors.toCollection(LinkedHashSet::new)));
92
        catalogItemDto.setTypes(Stream.of("type").collect(Collectors.toCollection(LinkedHashSet::new)));
93
        catalogItemDto.setAllNames(Stream.of("altName").collect(Collectors.toCollection(LinkedHashSet::new)));
94
        catalogItemDto.setCountries(Stream.of("country").collect(Collectors.toCollection(LinkedHashSet::new)));
95
        catalogItemDto.setWrittenForms(Stream.of("written").collect(Collectors.toCollection(LinkedHashSet::new)));
96
        catalogItemDto.setCertainty(0);
97
        catalogItemDto.setLatitude(0.1);
98
        catalogItemDto.setLongitude(0.2);
99
        catalogItemDto.setDescription("description");
100

    
101
        Type type = new Type("type");
102

    
103
        CatalogItem catalogItem = new CatalogItem();
104
        catalogItem.setName("name");
105
        catalogItem.setBibliography(Stream.of(new Bibliography("bibl", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
106
        catalogItem.setTypes(Stream.of(type).collect(Collectors.toCollection(LinkedHashSet::new)));
107
        catalogItem.setAllNames(Stream.of(new CatalogItemName("altName", catalogItem, 1), new CatalogItemName("name", catalogItem, 2)).collect(Collectors.toCollection(LinkedHashSet::new)));
108
        catalogItem.setCountries(Stream.of(new Country("country", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
109
        catalogItem.setWrittenForms(Stream.of(new WrittenForm("written", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
110
        catalogItem.setCertainty(0);
111
        catalogItem.setLatitude(0.1);
112
        catalogItem.setLongitude(0.2);
113
        catalogItem.setDescription("description");
114

    
115
        given(typeService.getTypeByName(anyString())).willReturn(Optional.of(type));
116

    
117
        // when
118
        underTest.saveCatalogItem(catalogItemDto);
119

    
120
        // then
121
        ArgumentCaptor<CatalogItem> argumentCaptor = ArgumentCaptor.forClass(CatalogItem.class);
122

    
123
        verify(catalogItemRepository).save(argumentCaptor.capture());
124
        verify(typeService, never()).saveType(type);
125

    
126
        CatalogItem capturedItem = argumentCaptor.getValue();
127

    
128
        assertThat(capturedItem.getName()).isEqualTo(catalogItem.getName());
129
        assertThat(capturedItem.getLongitude()).isEqualTo(catalogItem.getLongitude());
130
        assertThat(capturedItem.getLatitude()).isEqualTo(catalogItem.getLatitude());
131
        assertThat(capturedItem.getCertainty()).isEqualTo(catalogItem.getCertainty());
132
        assertThat(capturedItem.getAllNames().size()).isEqualTo(catalogItem.getAllNames().size());
133
        assertThat(capturedItem.getBibliography().size()).isEqualTo(catalogItem.getBibliography().size());
134
        assertThat(capturedItem.getCountries().size()).isEqualTo(catalogItem.getCountries().size());
135
        assertThat(capturedItem.getWrittenForms().size()).isEqualTo(catalogItem.getWrittenForms().size());
136
        assertThat(capturedItem.getTypes().size()).isEqualTo(catalogItem.getTypes().size());
137
        assertThat(capturedItem.getDescription()).isEqualTo(catalogItem.getDescription());
138

    
139
    }
140

    
141
    @Test
142
    void testCanGetCatalogItem() {
143
        // given
144
        UUID id = UUID.randomUUID();
145
        CatalogItem catalogItem = new CatalogItem();
146
        catalogItem.setId(id);
147
        CatalogItemDto catalogItemDto = new CatalogItemDto();
148
        catalogItemDto.setId(id);
149
        given(catalogItemRepository.findById(id)).willReturn(Optional.of(catalogItem));
150

    
151
        // when
152
        CatalogItemDto retrievedItemDto = underTest.getCatalogItem(id);
153

    
154
        // then
155
        verify(catalogItemRepository).findById(id);
156
        assertThat(retrievedItemDto).isEqualTo(catalogItemDto);
157
    }
158

    
159
    @Test
160
    void testCanNotGetCatalogItem() {
161
        // given
162
        UUID id = UUID.randomUUID();
163

    
164
        // when
165
        // then
166
        assertThatThrownBy(() -> underTest.getCatalogItem(id))
167
                .isInstanceOf(ApiRequestException.class)
168
                .hasMessageContaining("Catalog item not found");
169

    
170
        verify(catalogItemRepository).findById(id);
171
    }
172

    
173
    @Test
174
    void testCanUpdateCatalogItem() {
175
        // given
176
        UUID id = UUID.randomUUID();
177

    
178
        CatalogItemDto catalogItemDto = new CatalogItemDto();
179
        catalogItemDto.setName("name");
180
        catalogItemDto.setBibliography(Stream.of("bibl").collect(Collectors.toCollection(LinkedHashSet::new)));
181
        catalogItemDto.setTypes(Stream.of("type").collect(Collectors.toCollection(LinkedHashSet::new)));
182
        catalogItemDto.setAllNames(Stream.of("altName").collect(Collectors.toCollection(LinkedHashSet::new)));
183
        catalogItemDto.setCountries(Stream.of("country").collect(Collectors.toCollection(LinkedHashSet::new)));
184
        catalogItemDto.setWrittenForms(Stream.of("written").collect(Collectors.toCollection(LinkedHashSet::new)));
185
        catalogItemDto.setCertainty(0);
186
        catalogItemDto.setLatitude(0.1);
187
        catalogItemDto.setLongitude(0.2);
188
        catalogItemDto.setDescription("description");
189

    
190
        Type type = new Type("type");
191
        Type typeOld = new Type("old");
192

    
193
        CatalogItem catalogItem = new CatalogItem();
194
        catalogItem.setId(id);
195
        catalogItem.setName("name");
196
        catalogItem.setBibliography(Stream.of(new Bibliography("bibl", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
197
        catalogItem.setTypes(Stream.of(type).collect(Collectors.toCollection(LinkedHashSet::new)));
198
        catalogItem.setAllNames(Stream.of(new CatalogItemName("altName", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
199
        catalogItem.setCountries(Stream.of(new Country("country", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
200
        catalogItem.setWrittenForms(Stream.of(new WrittenForm("written", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
201
        catalogItem.setCertainty(0);
202
        catalogItem.setLatitude(0.1);
203
        catalogItem.setLongitude(0.2);
204
        catalogItem.setDescription("description");
205

    
206
        CatalogItem oldCatalogItem = new CatalogItem();
207
        oldCatalogItem.setId(id);
208
        oldCatalogItem.setName("old");
209
        oldCatalogItem.setBibliography(Stream.of(new Bibliography("old", oldCatalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
210
        oldCatalogItem.setTypes(Stream.of(typeOld).collect(Collectors.toCollection(LinkedHashSet::new)));
211
        oldCatalogItem.setAllNames(Stream.of(new CatalogItemName("old", oldCatalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
212
        oldCatalogItem.setCountries(Stream.of(new Country("old", oldCatalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
213
        oldCatalogItem.setWrittenForms(Stream.of(new WrittenForm("old", catalogItem, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
214
        oldCatalogItem.setCertainty(10);
215
        oldCatalogItem.setLatitude(10.1);
216
        oldCatalogItem.setLongitude(10.2);
217

    
218
        given(catalogItemRepository.findById(id)).willReturn(Optional.of(oldCatalogItem));
219
        given(typeService.getTypeByName(anyString())).willReturn(Optional.empty());
220

    
221
        // when
222

    
223
        underTest.updateCatalogItem(id, catalogItemDto);
224

    
225
        // then
226
        verify(typeService).saveType(type);
227

    
228
        ArgumentCaptor<CatalogItem> argumentCaptor = ArgumentCaptor.forClass(CatalogItem.class);
229

    
230
        verify(catalogItemRepository).save(argumentCaptor.capture());
231

    
232
        CatalogItem capturedCatalogItem = argumentCaptor.getValue();
233

    
234
        assertThat(capturedCatalogItem).isEqualTo(catalogItem);
235
        assertThat(capturedCatalogItem.getCertainty()).isEqualTo(catalogItem.getCertainty());
236
        assertThat(capturedCatalogItem.getLatitude()).isEqualTo(catalogItem.getLatitude());
237
        assertThat(capturedCatalogItem.getLongitude()).isEqualTo(catalogItem.getLongitude());
238
        assertThat(capturedCatalogItem.getDescription()).isEqualTo(catalogItem.getDescription());
239
        assertThat(capturedCatalogItem.getTypes().stream().map(Type::getType).collect(Collectors.toSet())).isEqualTo(catalogItem.getTypes().stream().map(Type::getType).collect(Collectors.toCollection(LinkedHashSet::new)));
240
        Set<String> alternativeNamesEntity = catalogItem.getAllNames().stream().map(CatalogItemName::getName).collect(Collectors.toCollection(LinkedHashSet::new));
241
        alternativeNamesEntity.add(catalogItem.getName());
242
        assertThat(capturedCatalogItem.getAllNames().stream().map(CatalogItemName::getName).collect(Collectors.toSet())).isEqualTo(alternativeNamesEntity);
243
        assertThat(capturedCatalogItem.getCountries().stream().map(Country::getName).collect(Collectors.toSet())).isEqualTo(catalogItem.getCountries().stream().map(Country::getName).collect(Collectors.toCollection(LinkedHashSet::new)));
244
        assertThat(capturedCatalogItem.getBibliography().stream().map(Bibliography::getSource).collect(Collectors.toSet())).isEqualTo(catalogItem.getBibliography().stream().map(Bibliography::getSource).collect(Collectors.toCollection(LinkedHashSet::new)));
245
        assertThat(capturedCatalogItem.getWrittenForms().stream().map(WrittenForm::getForm).collect(Collectors.toSet())).isEqualTo(catalogItem.getWrittenForms().stream().map(WrittenForm::getForm).collect(Collectors.toCollection(LinkedHashSet::new)));
246
    }
247

    
248
    @Test
249
    void testCanNotUpdateCatalogItem() {
250
        // given
251
        UUID id = UUID.randomUUID();
252

    
253
        CatalogItemDto catalogItemDto = new CatalogItemDto();
254
        catalogItemDto.setName("name");
255
        catalogItemDto.setBibliography(Stream.of("bibl").collect(Collectors.toCollection(LinkedHashSet::new)));
256
        catalogItemDto.setTypes(Stream.of("type").collect(Collectors.toCollection(LinkedHashSet::new)));
257
        catalogItemDto.setAllNames(Stream.of("altName").collect(Collectors.toCollection(LinkedHashSet::new)));
258
        catalogItemDto.setCountries(Stream.of("country").collect(Collectors.toCollection(LinkedHashSet::new)));
259
        catalogItemDto.setWrittenForms(Stream.of("written").collect(Collectors.toCollection(LinkedHashSet::new)));
260
        catalogItemDto.setCertainty(0);
261
        catalogItemDto.setLatitude(0.1);
262
        catalogItemDto.setLongitude(0.2);
263

    
264
        // when
265
        // then
266
        assertThatThrownBy(() -> underTest.updateCatalogItem(id, catalogItemDto))
267
                .isInstanceOf(ApiRequestException.class)
268
                .hasMessageContaining("Catalog item not found");
269

    
270
        verify(catalogItemRepository, never()).save(any());
271
        verify(typeService, never()).saveType(any());
272
    }
273

    
274
    @Test
275
    void testCanDeleteCatalogItem() {
276
        // given
277
        UUID id = UUID.randomUUID();
278
        given(catalogItemRepository.existsById(id)).willReturn(true);
279

    
280
        // when
281
        underTest.deleteCatalogItem(id);
282

    
283
        // then
284
        verify(catalogItemRepository).deleteById(id);
285
    }
286

    
287
    @Test
288
    void testCanNotDeleteCatalogItem() {
289
        // given
290
        UUID id = UUID.randomUUID();
291
        given(catalogItemRepository.existsById(id)).willReturn(false);
292

    
293
        // when
294
        // then
295
        assertThatThrownBy(() -> underTest.deleteCatalogItem(id))
296
                .isInstanceOf(ApiRequestException.class)
297
                .hasMessageContaining("Catalog item not found");
298

    
299
        verify(catalogItemRepository, never()).deleteById(any());
300
    }
301

    
302

    
303
    @Test
304
    void testSearchedTest() {
305
        // given
306
        String text = "The city of Azbar was found in first century near the ocean.  " +
307
                "⌈U-re-me-re⌉, another town , was found " +
308
                "in 1956.\nThe location of Huga and Duga is not known, but it was probably near Puga.";
309
        String highlightedText = "The <b>city</b> of <span style='color:green'>Azbar</span> was found in first century near the <b>ocean</b>.  " +
310
                "⌈<span style='color:green'>U-re-me-re</span>⌉, another town , was found " +
311
                "in 1956.\nThe location of <span style='color:red'>Huga</span> and <span style='color:red'>Duga</span> is not known, but it was probably near Puga.";
312

    
313
        CatalogItem catalogItem1 = new CatalogItem();
314
        catalogItem1.setAllNames(Stream.of(new CatalogItemName("Azbar", catalogItem1, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
315
        catalogItem1.setLatitude(5.0);
316
        catalogItem1.setLongitude(5.0);
317

    
318
        CatalogItem catalogItem2 = new CatalogItem();
319
        catalogItem2.setAllNames(Stream.of(new CatalogItemName("Azbar", catalogItem2, 1), new CatalogItemName("Azbarasdf", catalogItem2, 2)).collect(Collectors.toCollection(LinkedHashSet::new)));
320
        catalogItem2.setLatitude(null);
321
        catalogItem2.setLongitude(null);
322

    
323
        CatalogItem catalogItem3 = new CatalogItem();
324
        catalogItem3.setAllNames(Stream.of(new CatalogItemName("U-re-me-re", catalogItem3, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
325
        catalogItem3.setLatitude(55.0);
326
        catalogItem3.setLongitude(68.0);
327

    
328
        CatalogItem catalogItem4 = new CatalogItem();
329
        catalogItem4.setAllNames(Stream.of(new CatalogItemName("Huga", catalogItem4, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
330
        catalogItem4.setLatitude(null);
331
        catalogItem4.setLongitude(null);
332

    
333
        CatalogItem catalogItem5 = new CatalogItem();
334
        catalogItem5.setAllNames(Stream.of(new CatalogItemName("Huga", catalogItem5, 1), new CatalogItemName("Hugaa", catalogItem5, 2)).collect(Collectors.toCollection(LinkedHashSet::new)));
335
        catalogItem5.setLatitude(null);
336
        catalogItem5.setLongitude(null);
337

    
338
        CatalogItem catalogItem6 = new CatalogItem();
339
        catalogItem6.setAllNames(Stream.of(new CatalogItemName("Duga", catalogItem6, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
340
        catalogItem6.setLatitude(null);
341
        catalogItem6.setLongitude(null);
342

    
343
        CatalogItemDto catalogItemDto1 = new CatalogItemDto();
344
        catalogItemDto1.setId(catalogItem1.getId());
345
        catalogItemDto1.setAllNames(Stream.of("Azbar").collect(Collectors.toCollection(LinkedHashSet::new)));
346
        catalogItemDto1.setLatitude(5.0);
347
        catalogItemDto1.setLongitude(5.0);
348

    
349
        CatalogItemDto catalogItemDto2 = new CatalogItemDto();
350
        catalogItemDto2.setId(catalogItem2.getId());
351
        catalogItemDto2.setAllNames(Stream.of("Azbar", "Azbarasdf").collect(Collectors.toCollection(LinkedHashSet::new)));
352
        catalogItemDto2.setLatitude(null);
353
        catalogItemDto2.setLongitude(null);
354

    
355
        CatalogItemDto catalogItemDto3 = new CatalogItemDto();
356
        catalogItemDto3.setId(catalogItem3.getId());
357
        catalogItemDto3.setAllNames(Stream.of("U-re-me-re").collect(Collectors.toCollection(LinkedHashSet::new)));
358
        catalogItemDto3.setLatitude(55.0);
359
        catalogItemDto3.setLongitude(68.0);
360

    
361
        CatalogItemDto catalogItemDto4 = new CatalogItemDto();
362
        catalogItemDto4.setId(catalogItem4.getId());
363
        catalogItemDto4.setAllNames(Stream.of("Huga").collect(Collectors.toCollection(LinkedHashSet::new)));
364
        catalogItemDto4.setLatitude(null);
365
        catalogItemDto4.setLongitude(null);
366

    
367
        CatalogItemDto catalogItemDto5 = new CatalogItemDto();
368
        catalogItemDto5.setId(catalogItem5.getId());
369
        catalogItemDto5.setAllNames(Stream.of("Huga", "Hugaa").collect(Collectors.toCollection(LinkedHashSet::new)));
370
        catalogItemDto5.setLatitude(null);
371
        catalogItemDto5.setLongitude(null);
372

    
373
        CatalogItemDto catalogItemDto6 = new CatalogItemDto();
374
        catalogItemDto6.setId(catalogItem6.getId());
375
        catalogItemDto6.setAllNames(Stream.of("Duga").collect(Collectors.toCollection(LinkedHashSet::new)));
376
        catalogItemDto6.setLatitude(null);
377
        catalogItemDto6.setLongitude(null);
378

    
379

    
380
        given(typeService.getAllTypesAsString()).willReturn(Stream.of("city", "ocean").collect(Collectors.toCollection(LinkedHashSet::new)));
381
        given(catalogItemRepository.getItemsByName(anyString())).willReturn(Collections.emptyList());
382
        given(catalogItemRepository.getItemsByName("Azbar")).willReturn(Stream.of(catalogItem1, catalogItem2).collect(Collectors.toList()));
383
        given(catalogItemRepository.getItemsByName("U-re-me-re")).willReturn(Stream.of(catalogItem3).collect(Collectors.toList()));
384
        given(catalogItemRepository.getItemsByName("Huga")).willReturn(Stream.of(catalogItem4, catalogItem5).collect(Collectors.toList()));
385
        given(catalogItemRepository.getItemsByName("Duga")).willReturn(Stream.of(catalogItem6).collect(Collectors.toList()));
386

    
387
        // when
388
        PathDto pathDto = underTest.getPath(text);
389

    
390
        // then
391
        verify(catalogItemRepository).getItemsByName("Azbar");
392
        verify(catalogItemRepository).getItemsByName("U-re-me-re");
393
        verify(catalogItemRepository).getItemsByName("Huga");
394
        verify(catalogItemRepository).getItemsByName("Duga");
395
        verify(catalogItemRepository).getItemsByName("Puga");
396

    
397
        assertThat(pathDto.getText()).isEqualTo(highlightedText);
398

    
399
        assertThat(pathDto.getFoundCatalogItems().size()).isEqualTo(4);
400

    
401
        assertThat(pathDto.getFoundCatalogItems().get(0).size()).isEqualTo(2);
402
        assertThat(pathDto.getFoundCatalogItems().get(0).get(0)).isEqualTo(catalogItemDto1);
403
        assertThat(pathDto.getFoundCatalogItems().get(0).get(1)).isEqualTo(catalogItemDto2);
404

    
405
        assertThat(pathDto.getFoundCatalogItems().get(1).size()).isEqualTo(1);
406
        assertThat(pathDto.getFoundCatalogItems().get(1).get(0)).isEqualTo(catalogItemDto3);
407

    
408
        assertThat(pathDto.getFoundCatalogItems().get(2).size()).isEqualTo(2);
409
        assertThat(pathDto.getFoundCatalogItems().get(2).get(0)).isEqualTo(catalogItemDto4);
410
        assertThat(pathDto.getFoundCatalogItems().get(2).get(1)).isEqualTo(catalogItemDto5);
411

    
412
        assertThat(pathDto.getFoundCatalogItems().get(3).size()).isEqualTo(1);
413
        assertThat(pathDto.getFoundCatalogItems().get(3).get(0)).isEqualTo(catalogItemDto6);
414
    }
415
}
(3-3/3)