@Test public void testGetElements() { final UserModel user = userService.getUserForUID("abrode"); final List<CockpitObjectSpecialCollectionModel> collections = cockpitCollectionService.getSpecialCollections(user, "quickcollection"); CockpitObjectSpecialCollectionModel threeElementsCollection = null; for (final CockpitObjectSpecialCollectionModel collection : collections) { if ("testSpecialB".equals(collection.getQualifier())) { threeElementsCollection = collection; break; } } assertThat(threeElementsCollection).isNotNull(); List<ItemModel> elements = cockpitCollectionService.getElements(threeElementsCollection, 0, 100); assertThat(elements.size()).isEqualTo(3); assertThat(elements.get(0) instanceof ProductModel).isTrue(); elements = cockpitCollectionService.getElements(threeElementsCollection, 0, 2); assertThat(elements.size()).isEqualTo(2); }
@Test public void testGetSpecialCollections() { final UserModel user = userService.getUserForUID("abrode"); final List<CockpitObjectSpecialCollectionModel> collections = cockpitCollectionService.getSpecialCollections(user, "quickcollection"); assertThat(collections).isNotNull(); assertThat(collections.size()).isEqualTo(1); assertThat(collections.get(0).getQualifier()).isEqualTo("testSpecialB"); assertThat(collections.get(0).getCollectionType().getCode()).isEqualTo("quickcollection"); assertThat(collections.get(0).getElements().size()).isEqualTo(3); }