Revize fb55e8e9
Přidáno uživatelem Jakub Šmíd před asi 2 roky(ů)
backend/src/test/java/cz/zcu/kiv/backendapi/catalog/CatalogItemRepositoryTest.java | ||
---|---|---|
1 | 1 |
package cz.zcu.kiv.backendapi.catalog; |
2 | 2 |
|
3 |
import cz.zcu.kiv.backendapi.alternativename.AlternativeName;
|
|
3 |
import cz.zcu.kiv.backendapi.alternativename.CatalogItemName;
|
|
4 | 4 |
import org.junit.jupiter.api.Test; |
5 | 5 |
import org.springframework.beans.factory.annotation.Autowired; |
6 | 6 |
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; |
7 | 7 |
|
8 |
import java.util.LinkedHashSet; |
|
8 | 9 |
import java.util.List; |
9 |
import java.util.Set; |
|
10 |
import java.util.stream.Collectors; |
|
11 |
import java.util.stream.Stream; |
|
10 | 12 |
|
11 | 13 |
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; |
12 | 14 |
import static org.junit.jupiter.api.Assertions.assertTrue; |
... | ... | |
37 | 39 |
catalogItem1.setName(nameFirst); |
38 | 40 |
|
39 | 41 |
catalogItem2.setName(nameSecond); |
40 |
catalogItem2.setAlternativeNames(Set.of(new AlternativeName(nameTwelve, catalogItem2), new AlternativeName(nameThird, catalogItem2)));
|
|
42 |
catalogItem2.setAllNames(Stream.of(new CatalogItemName(nameTwelve, catalogItem2, 1), new CatalogItemName(nameThird, catalogItem2, 2)).collect(Collectors.toCollection(LinkedHashSet::new)));
|
|
41 | 43 |
|
42 | 44 |
catalogItem3.setName(nameThird); |
43 |
catalogItem3.setAlternativeNames(Set.of(new AlternativeName(nameTwentyUpper, catalogItem3), new AlternativeName(nameSedond, catalogItem3)));
|
|
45 |
catalogItem3.setAllNames(Stream.of(new CatalogItemName(nameTwentyUpper, catalogItem3, 1), new CatalogItemName(nameSedond, catalogItem3, 2)).collect(Collectors.toCollection(LinkedHashSet::new)));
|
|
44 | 46 |
|
45 |
catalogItem4.setAlternativeNames(Set.of(new AlternativeName(nameTwelve, catalogItem4), new AlternativeName(nameFirstUpper, catalogItem4)));
|
|
47 |
catalogItem4.setAllNames(Stream.of(new CatalogItemName(nameTwelve, catalogItem4, 1), new CatalogItemName(nameFirstUpper, catalogItem4, 2)).collect(Collectors.toCollection(LinkedHashSet::new)));
|
|
46 | 48 |
|
47 | 49 |
catalogItem5.setName(nameSedond); |
48 |
catalogItem5.setAlternativeNames(Set.of(new AlternativeName(nameThird, catalogItem5)));
|
|
50 |
catalogItem5.setAllNames(Stream.of(new CatalogItemName(nameThird, catalogItem5, 1)).collect(Collectors.toCollection(LinkedHashSet::new)));
|
|
49 | 51 |
|
50 | 52 |
underTest.saveAll(List.of(catalogItem1, catalogItem2, catalogItem3, catalogItem4, catalogItem5)); |
51 | 53 |
|
Také k dispozici: Unified diff
Catalog change
- one-to-many associations now persist order
- text for search persists separators
re #9751
re #9754