@Test(timeout = 1000) public void testIsPresentArticleMiddleEvenList() { buildList(maxLength); panierTest = new ItemsSortedList(testList); testItem = new Item("item" + (maxLength / 2), maxLength / 2); assertTrue(panierTest.isPresentArticle(testItem)); }
@Test(timeout = 1000) public void testIsPresentArticleWrongNameOddList() { buildList(maxLength + 1); panierTest = new ItemsSortedList(testList); testItem = new Item("item2", 3); assertFalse(panierTest.isPresentArticle(testItem)); }
@Test(timeout = 1000) public void testIsPresentArticleOnNotPresentItemEvenList() { buildList(maxLength); panierTest = new ItemsSortedList(testList); testItem = new Item("item" + maxLength, maxLength); assertFalse(panierTest.isPresentArticle(testItem)); }
@Test(timeout = 1000) public void testIsPresentArticleLastOddList() { buildList(maxLength + 1); panierTest = new ItemsSortedList(testList); testItem = new Item("item" + (maxLength - 1), maxLength - 1); assertTrue(panierTest.isPresentArticle(testItem)); }
@Test(expected = NullPointerException.class) public void testIsPresentArticleOnNullEvenList() { buildList(maxLength); panierTest = new ItemsSortedList(testList); testItem = null; panierTest.isPresentArticle(testItem); fail(); }
@Test(timeout = 1000) public void testIsPresentArticleSimilarItemsAtEndSwitchedOddList() { buildList(maxLength + 1); testList.add(maxLength + 1 + 1, new Item("test", maxLength + 1)); panierTest = new ItemsSortedList(testList); testItem = new Item("item" + (maxLength + 1), maxLength + 1); assertTrue(panierTest.isPresentArticle(testItem)); }
@Test(timeout = 1000) public void testIsPresentArticleSimilarItemsAtBeginOddList() { buildList(maxLength + 1); testList.add(0, new Item("test", 0)); panierTest = new ItemsSortedList(testList); testItem = new Item("item0", 0); assertTrue(panierTest.isPresentArticle(testItem)); }
@Test(timeout = 1000) public void testIsPresentArticleAfterMiddleOddList() { buildList(maxLength + 1); panierTest = new ItemsSortedList(testList); int index = maxLength / 2 + 1; testItem = new Item("item" + index, index); assertTrue(panierTest.isPresentArticle(testItem)); }
@Test(timeout = 1000) public void testIsPresentArticleSimilarItemsAtHalfSwitchedOddList() { buildList(maxLength + 1); int index = (maxLength + 1) / 2 - 1; testList.add(index + 1, new Item("test", index)); panierTest = new ItemsSortedList(testList); testItem = new Item("item" + index, index); assertTrue(panierTest.isPresentArticle(testItem)); }