id
stringlengths
36
36
text
stringlengths
1
1.25M
67087e38-ad9d-420e-bcc4-b77eb1f9a6f0
protected int getPages(int i) { return i * TESTBOOK_COUNT - TESTBOOK_COUNT; }
ba9b8868-c1f1-4304-bddf-22d286670c02
protected Date getPublication(int i) { return dates.get(i); }
d15f21fa-428b-471f-a165-4dc91e9b6a0d
@Test public void testConstructorForTitle() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); for(int i = 0; i < TESTBOOK_COUNT; i++){ String element = subElementList.get(i); Assert.assertEquals(element, getTitle(i)); } }
73e09b98-2d4a-4ef2-a17b-5847b1128b89
@Test public void testConstructorForAuthor() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); for(int i = 0; i < TESTBOOK_COUNT; i++){ String element = subElementList.get(i); Assert.assertEquals(element, getAuthor(i)); } }
4278eb61-ea7f-4a24-a155-2df972ea315b
@Test public void testConstructorForContent() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); for(int i = 0; i < TESTBOOK_COUNT; i++){ String element = subElementList.get(i); Assert.assertEquals(element, getContent(i)); } }
36d0949b-8389-4469-b960-2be33b9bac6f
@Test public void testConstructorForPages() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); for(int i = 0; i < TESTBOOK_COUNT; i++){ int element = subElementList.get(i); Assert.assertEquals(element, getPages(i)); } }
d10be774-6d5f-49d7-b62e-70720095e55d
@Test public void testConstructorForPublication() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); for(int i = 0; i < TESTBOOK_COUNT; i++){ Date element = subElementList.get(i); Assert.assertEquals(element, getPublication(i)); } }
02aef973-1008-4c2f-affc-92464a378d4f
@Test public void testTitleToStringArray() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); String[] subElementsArray = subElementList.toArray(new String[subElementList.size()]); testToArrayWithParameter(subElementList, subElementsArray); }
5de87436-2322-4253-bb59-a773485ff0ba
@Test public void testAuthorToStringArray() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); String[] subElementsArray = subElementList.toArray(new String[subElementList.size()]); testToArrayWithParameter(subElementList, subElementsArray); }
f89c1302-a643-46a3-bb90-2740e69aebbf
@Test public void testContentToStringArray() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); String[] subElementsArray = subElementList.toArray(new String[subElementList.size()]); testToArrayWithParameter(subElementList, subElementsArray); }
5450fa78-9cdc-4ffb-8280-543805a3d423
@Test public void testPublicationToStringArray() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); Date[] subElementsArray = subElementList.toArray(new Date[subElementList.size()]); testToArrayWithParameter(subElementList, subElementsArray); }
2377941c-8540-4db8-b7dd-31577fb6fa8f
@Test public void testPagesToStringArray() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); Integer[] subElementsArray = subElementList.toArray(new Integer[subElementList.size()]); testToArrayWithParameter(subElementList, subElementsArray); }
71855fc8-491b-46e9-9cac-b0befc5d6e5c
@Test public void testTitleContainsRemoveAllEmpty() throws Exception { SubElementList<String> subElementList1 = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); testContainsRemoveAllEmpty(subElementList1); }
26dd1c6e-01f9-4c80-92c9-d1a8b73f8fa7
@Test public void testAuthorContainsRemoveAllEmpty() throws Exception { SubElementList<String> subElementList1 = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); testContainsRemoveAllEmpty(subElementList1); }
9bc4d447-0de8-4ae3-84f5-4a9f1227afe4
@Test public void testContentContainsRemoveAllEmpty() throws Exception { SubElementList<String> subElementList1 = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); testContainsRemoveAllEmpty(subElementList1); }
ab3fd3bd-493b-4350-a138-28570cc5570c
@Test public void testPagesContainsRemoveAllEmpty() throws Exception { SubElementList<String> subElementList1 = new SubElementList<String>(testBooks, TestBook.class.getMethod("getPages")); testContainsRemoveAllEmpty(subElementList1); }
6467758b-ea9c-44cb-b69d-be3578623b6e
@Test public void testPublicationContainsRemoveAllEmpty() throws Exception { SubElementList<String> subElementList1 = new SubElementList<String>(testBooks, TestBook.class.getMethod("getPublication")); testContainsRemoveAllEmpty(subElementList1); }
22756339-d51a-452c-a060-b3034e41539a
@Test public void testTitleRemoveElements() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); testRemoveElements(subElementList); }
09ed25a2-045d-4e30-a40b-ecb2282039f6
@Test public void testAuthorRemoveElements() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); testRemoveElements(subElementList); }
71b9c3f3-69c9-4672-aee0-653c88bbe8d0
@Test public void testContentRemoveElements() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); testRemoveElements(subElementList); }
6d5ff702-8af2-4b89-9351-eae9d36b7f9b
@Test public void testPagesRemoveElements() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); testRemoveElements(subElementList); }
624c9f3c-350d-406a-a11f-cc4232806c78
@Test public void testPublicationRemoveElements() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); testRemoveElements(subElementList); }
c12fc65f-0958-4360-b5aa-1ff9478deccf
@Test public void testTitleParentList() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); testParentList(subElementList); }
b0d0b1b7-7ab5-4ee4-ba12-7f07c3c0b671
@Test public void testAuthorParentList() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); testParentList(subElementList); }
a5b5d6aa-5b70-4a3a-b624-404ab6f9c34c
@Test public void testContentParentList() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); testParentList(subElementList); }
b1fd5781-4574-4df7-af9b-3607d47f6e33
@Test public void testPagesParentList() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); testParentList(subElementList); }
5ebf35df-01c0-4973-9f94-8fe3b5a923d1
@Test public void testPublicationParentList() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); testParentList(subElementList); }
02f59512-b66e-4619-8528-ebb072d891fe
@Test public void testTitleSubList() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); testSubList(subElementList); }
a84d8e5b-9bea-411d-a98b-b3d80fe381fe
@Test public void testAuthorSubList() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); testSubList(subElementList); }
d433a3a4-4c6a-4039-9820-6510f036b505
@Test public void testContentSubList() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); testSubList(subElementList); }
b183666e-b8b8-4d52-9fe9-ccb19be0478d
@Test public void testPagesSubList() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getPages")); testSubList(subElementList); }
dc355e26-0bc5-48a3-81e8-4f5571b15143
@Test public void testPublicationSubList() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getPublication")); testSubList(subElementList); }
c1b8d91b-1dbe-4aa6-9704-b2ed282046e6
@Test(expectedExceptions = UnsupportedOperationException.class) public void testTitleToArray() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); subElementList.toArray(); }
8f611ca7-5533-4d70-839a-a90b167e8ea2
@Test(expectedExceptions = UnsupportedOperationException.class) public void testAuthorToArray() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); subElementList.toArray(); }
0347014e-2f07-426a-8d9d-e7a77a23aa2b
@Test(expectedExceptions = UnsupportedOperationException.class) public void testContentToArray() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); subElementList.toArray(); }
e83cc167-e1eb-47f6-bc2a-a736862daf5e
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPagesToArray() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); subElementList.toArray(); }
194a941f-1411-4018-914f-3518acd7894a
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPublicationToArray() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); subElementList.toArray(); }
4f93b595-f632-4d68-a08b-881d7fdb0943
@Test(expectedExceptions = UnsupportedOperationException.class) public void testTitleAdd() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); subElementList.add(new String()); }
a6e653f7-2eae-46c2-a355-faafffd3656f
@Test(expectedExceptions = UnsupportedOperationException.class) public void testAuthorAdd() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); subElementList.add(new String()); }
5b0aa4de-d51e-4f9b-87c5-9aaa7f4cd00a
@Test(expectedExceptions = UnsupportedOperationException.class) public void testContentAdd() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); subElementList.add(new String()); }
98a9dbf4-4c03-4549-8f0b-98929e819484
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPagesAdd() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); subElementList.add(new Integer(0)); }
2a48d3f4-e1a6-4c87-8d43-6d9843682aff
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPublicationAdd() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); subElementList.add(new Date()); }
985c43d5-c187-47fe-ac11-3eba09e2f382
@Test(expectedExceptions = UnsupportedOperationException.class) public void testTitleSet() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); subElementList.set(0, new String()); }
7e1a1381-ff12-45dc-8b06-d38ec8d2ddb4
@Test(expectedExceptions = UnsupportedOperationException.class) public void testAuthorSet() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); subElementList.set(0, new String()); }
d9c83792-0dd0-48e9-b2fc-12d71ed89e4e
@Test(expectedExceptions = UnsupportedOperationException.class) public void testContentSet() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); subElementList.set(0, new String()); }
32526eff-e00e-44e0-8602-5eafe92fee04
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPagesSet() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); subElementList.set(0, new Integer(0)); }
691f966e-e6c1-485c-a729-3c266ad93f97
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPublicationSet() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); subElementList.set(0, new Date()); }
50f34993-101c-4d43-9e89-16ae9260d7f6
@Test(expectedExceptions = UnsupportedOperationException.class) public void testTitleAddAt() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); subElementList.add(0, new String()); }
2a17fea9-0167-4f82-8a29-be483da52793
@Test(expectedExceptions = UnsupportedOperationException.class) public void testAuthorAddAt() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); subElementList.add(0, new String()); }
aa726d36-3c11-439b-a7c5-d4bae346795e
@Test(expectedExceptions = UnsupportedOperationException.class) public void testContentAddAt() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); subElementList.add(0, new String()); }
756a77c0-bb37-4ced-b13a-2698dca4c1c7
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPagesAddAt() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); subElementList.add(0, new Integer(0)); }
d171c780-5bb5-41fc-9fd3-e26bb2e27225
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPublicationAddAt() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); subElementList.add(0, new Date()); }
dfe16de6-e591-4033-b20f-1604af729191
@Test(expectedExceptions = UnsupportedOperationException.class) public void testTitleListIterator() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); subElementList.listIterator(); }
a0fb8f1e-d804-4748-a53a-1f85529a5b7e
@Test(expectedExceptions = UnsupportedOperationException.class) public void testAuthorListIterator() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); subElementList.listIterator(); }
03c472fd-6ec2-48ed-b0b1-7cf355a0c8f2
@Test(expectedExceptions = UnsupportedOperationException.class) public void testContentListIterator() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); subElementList.listIterator(); }
c3b304e6-2a64-4f15-ab69-e09e1ec44caa
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPagesListIterator() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); subElementList.listIterator(); }
f027dd96-7ecb-45ec-aa32-7746a3639fb6
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPublicationListIterator() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); subElementList.listIterator(); }
2c699e7a-af58-499e-a651-13badd3bc099
@Test(expectedExceptions = UnsupportedOperationException.class) public void testTitleListIteratorAt() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); subElementList.listIterator(0); }
77ffca26-43c8-4fc8-aa14-92673b36dfa8
@Test(expectedExceptions = UnsupportedOperationException.class) public void testAuthorListIteratorAt() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); subElementList.listIterator(0); }
d4a0f76c-d4fa-4ac9-815d-04843d8e0992
@Test(expectedExceptions = UnsupportedOperationException.class) public void testContentListIteratorAt() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); subElementList.listIterator(0); }
da09f9aa-f275-49b8-b9b8-1440c77da769
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPagesListIteratorAt() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); subElementList.listIterator(0); }
658d72cf-6cbf-4433-b814-5a565cf8b270
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPublicationListIteratorAt() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); subElementList.listIterator(0); }
b9d01cdc-e17d-4f92-9561-20eb9f5b3143
@Test(expectedExceptions = UnsupportedOperationException.class) public void testTitleAddAll() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); subElementList.addAll(subElementList); }
7387fca9-9cbb-46d3-a589-537b124ef12c
@Test(expectedExceptions = UnsupportedOperationException.class) public void testAuthorAddAll() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); subElementList.addAll(subElementList); }
83ba19e9-ae04-40f2-8250-374ded2d0d38
@Test(expectedExceptions = UnsupportedOperationException.class) public void testContentAddAll() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); subElementList.addAll(subElementList); }
57567541-33a4-4625-be86-9d818e39ce1a
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPagesAddAll() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); subElementList.addAll(subElementList); }
f0aeef35-8c7e-4efd-9748-90fa1e419e29
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPublicationAddAll() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); subElementList.addAll(subElementList); }
c872ef60-8f04-4585-9867-ab74784595f0
@Test(expectedExceptions = UnsupportedOperationException.class) public void testTitleAddAllAt() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getTitle")); subElementList.addAll(0, subElementList); }
8c3ea97d-0be8-4130-b918-506404843f07
@Test(expectedExceptions = UnsupportedOperationException.class) public void testAuthorAddAllAt() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getAuthor")); subElementList.addAll(0, subElementList); }
4c70238e-7025-4a0b-bfdd-c5d29dd355f9
@Test(expectedExceptions = UnsupportedOperationException.class) public void testContentAddAllAt() throws Exception { SubElementList<String> subElementList = new SubElementList<String>(testBooks, TestBook.class.getMethod("getContent")); subElementList.addAll(0, subElementList); }
0ad4c2d3-dd9e-4129-999c-dc010ac080cb
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPagesAddAllAt() throws Exception { SubElementList<Integer> subElementList = new SubElementList<Integer>(testBooks, TestBook.class.getMethod("getPages")); subElementList.addAll(0, subElementList); }
00161ed2-a92c-42ea-8586-5c603d3669ea
@Test(expectedExceptions = UnsupportedOperationException.class) public void testPublicationAddAllAt() throws Exception { SubElementList<Date> subElementList = new SubElementList<Date>(testBooks, TestBook.class.getMethod("getPublication")); subElementList.addAll(0, subElementList); }
7181425f-9870-4140-97a4-066e697f9dbc
private <T> void testSubList(SubElementList<T> subElementList) { SubElementList<T> subSubElementList = (SubElementList<T>) subElementList.subList(1, 9); Assert.assertEquals(subSubElementList.size(), 8); }
afcdd74d-bac4-42f2-a39e-bac83da9d243
private void testParentList(SubElementList subElementList) throws Exception { List<TestBook> parentList = subElementList.getParentList(); Assert.assertEquals(parentList, testBooks); Assert.assertTrue(parentList.equals(testBooks)); parentList.remove(0); Assert.assertNotEquals(parentList, testBooks); Assert.assertFalse(parentList.equals(testBooks)); }
f7f22632-b813-4734-a86b-a242ce865069
private void testRemoveElements(SubElementList subElementList) throws Exception { int oldSize = subElementList.size(); for (int i = 0; i < subElementList.size(); i++) { subElementList.remove(i); Assert.assertTrue(oldSize > subElementList.size()); } oldSize = subElementList.size(); for (int i = subElementList.size() - 1; i >= 0; i--) { subElementList.remove(i); Assert.assertTrue(oldSize > subElementList.size()); } Assert.assertEquals(subElementList.size(), 0); Assert.assertTrue(subElementList.isEmpty()); Assert.assertFalse(subElementList.remove(new String())); }
8b5ee2cc-9aaf-4325-bf6a-f9370be845a6
private <T> void testContainsRemoveAllEmpty(SubElementList<T> subElementList1) throws Exception { SubElementList<T> subElementList2 = subElementList1.clone(); Assert.assertTrue(subElementList1.containsAll(subElementList2)); Assert.assertEquals(subElementList1.indexOf(null), -1); Assert.assertEquals(subElementList1.lastIndexOf(null), -1); Assert.assertEquals(subElementList1.indexOf(subElementList2.get(0)), 0); Assert.assertEquals(subElementList1.lastIndexOf(subElementList2.get(0)), 0); Assert.assertEquals(subElementList1.hashCode(), subElementList2.hashCode()); Assert.assertEquals(subElementList1.size(), subElementList2.size()); Assert.assertTrue(subElementList1.equals(subElementList2)); Assert.assertTrue(subElementList1.equals(subElementList1)); Assert.assertFalse(subElementList1.equals(new String())); Assert.assertFalse(subElementList1.isEmpty()); Assert.assertTrue(subElementList1.removeAll(subElementList2)); Assert.assertFalse(subElementList1.removeAll(subElementList2)); Assert.assertTrue(subElementList1.size() == 0); Assert.assertTrue(subElementList1.isEmpty()); Assert.assertFalse(subElementList1.containsAll(subElementList2)); Assert.assertTrue(subElementList2.containsAll(subElementList1)); Assert.assertFalse(subElementList1.retainAll(subElementList2)); subElementList1 = subElementList2.clone(); Assert.assertTrue(subElementList1.size() > 0); Assert.assertTrue(subElementList1.size() == subElementList2.size()); Assert.assertEquals(subElementList1.indexOf(null), -1); Assert.assertEquals(subElementList1.lastIndexOf(null), -1); Assert.assertTrue(subElementList1.retainAll(subElementList2)); subElementList1.clear(); subElementList2.clear(); Assert.assertEquals(subElementList1.size(), 0); Assert.assertEquals(subElementList2.size(), 0); Assert.assertEquals(subElementList1.size(), subElementList2.size()); Assert.assertTrue(subElementList1.equals(subElementList2)); Assert.assertEquals(subElementList1.hashCode(), subElementList2.hashCode()); }
d81503f3-b583-401f-bfce-8e6ca3f1fb0c
private <T> void testToArrayWithParameter(SubElementList<T> subElementList, T[] subElementsArray){ for(int i = 0; i < TESTBOOK_COUNT; i++){ Assert.assertEquals(subElementsArray[i], subElementList.get(i)); } }
320b2337-f606-47f5-9853-b257435ed504
public TestBook(String title, String author, String content, int pages, Date publication) { this.title = title; this.author = author; this.content = content; this.pages = pages; this.publication = publication; }
9725946b-0c78-4a75-8e9b-01344105f2a0
public Date getPublication() { return publication; }
1007e9fd-d626-44a5-8365-6bf42344fc8e
public void setPublication(Date publication) { this.publication = publication; }
a215e57b-42c4-4ec3-88d7-4f3fee65e754
public int getPages() { return pages; }
04e62d57-9edc-42b7-9c61-7ccaedf5c1dc
public void setPages(int pages) { this.pages = pages; }
12912773-8299-4b14-9d67-41ad0696690f
public String getContent() { return content; }
e6fbfddc-1450-491c-9da4-bbc65435ef92
public void setContent(String content) { this.content = content; }
2b2bec6e-9015-4a11-92d4-c040bbce0a3d
public String getAuthor() { return author; }
a2c0c4c6-a7f0-4558-87f3-e6f2ae7c1ec1
public void setAuthor(String author) { this.author = author; }
ee380562-6e02-4a0d-ab6e-2a1d4c3396d4
public String getTitle() { return title; }
da6ffaee-d49f-4270-8bad-7d0fb0d5364a
public void setTitle(String title) { this.title = title; }
31dfb8cd-6715-4cba-a5d3-04365b8df5ad
Queen(ChessBoard boardRef,boolean color, int row, int column,boolean moved) {//konstruktor pro nacteni nove hry/hry ze souboru super(boardRef, color, row, column, moved); }
3c527c7e-1eda-4ef0-b016-7959425ec180
Queen(Chessman copy, int column, int row) {//konstruktor k presouvani po sachovnici super(); this.color = copy.color; this.row = row; this.column = column; this.ref = copy.ref; }
772e2b97-e2d9-4876-923a-253090e4b949
@Override public boolean move(boolean really,int column, int row){//vrati true, pokud je tah na pole [column][row] mozny. pokud je navic argument really = true, tah se i provede if(inRange(column, row)&& ref.isNotMine(column, row)){ Queen backUp; Chessman ten; backUp = this; ten = ref.board[column][row]; ref.board[column][row] = new Queen(this,column,row); ref.board[this.column][this.row] = null; //ref.print(); boolean b = ref.isChecked(); if(really) { if(b) { ref.board[backUp.column][backUp.row] = backUp; ref.board[column][row] = ten; //System.out.println("vracim false bo by to byl sach"); return false; } else { //System.out.println("ok, vracim true"); ref.board[column][row].moved = true; return true; } } else{ ref.board[backUp.column][backUp.row] = backUp; ref.board[column][row] = ten; //System.out.println("jen zjistuju, nehejbu"); return !b; } } else { //System.out.println("neni range nebo je moje"); return false; } }
661e77b9-9ccd-422d-989e-1c2a96c0bcfc
@Override public boolean inRange(int column, int row) { //vrati true, pokud je pole [row][column] v dosahu figury if(column == this.column) { if(row > this.row) { for(int i = 1;i < row-this.row; i++) { if(!ref.isFree(this.column, this.row+i)) { return false; } } return true; } if(row < this.row) { for(int i = 1;i < this.row-row; i++) { if(!ref.isFree(this.column, this.row-i)) { return false; } } return true; } } if(row == this.row) { if(column > this.column) { for(int i = 1;i < column-this.column; i++) { //System.out.println("i = " +i +"...do: " + (column-this.column-1) + " ....momentalne testuju: " + (this.column+i) + " " + this.row ); if(!ref.isFree(this.column+i, this.row)) { return false; } } return true; } if(column < this.column) { for(int i = 1;i < this.column-column; i++) { if(!ref.isFree(this.column-i, this.row)) { return false; } } return true; } } if(Math.abs(this.column - column) == Math.abs(this.row - row)) { //System.out.println("ok"); if(this.column < column && this.row < row) { for(int i = 1; i < (column - this.column);i++) { //System.out.println(i); if(!ref.isFree(this.column+i, this.row+i)) { return false; } } return true; } if(this.column > column && this.row > row) { for(int i = 1; i < (this.column - column);i++) { //System.out.println(i); if(!ref.isFree(this.column-i, this.row-i)) { return false; } } return true; } if(this.column < column && this.row > row) { for(int i = 1; i < (column - this.column);i++) { //System.out.println(i); if(!ref.isFree(this.column+i, this.row-i)) { return false; } } return true; } if(this.column > column && this.row < row) { for(int i = 1; i < (this.column - column);i++) { //System.out.println(i); if(!ref.isFree(this.column-i, this.row+i)) { return false; } } return true; } } return false; }
bb53dc7e-dceb-446e-9aa5-fcd92e83d816
@Override public String toString() { if (this.color == true) { return "Q"; } else { return "q"; } }
f2f03173-4675-4dec-8502-33bb611ab1d5
Pawn(ChessBoard boardRef,boolean color, int row, int column,boolean moved) { //konstruktor pro nacteni nove hry/hry ze souboru super(boardRef, color, row, column,moved); }
5e627f6e-6e73-4a32-a973-d09a1b3e730a
Pawn(Chessman copy, int column, int row) {//konstruktor k presouvani po sachovnici super(); this.color = copy.color; this.row = row; this.column = column; this.ref = copy.ref; }
7b5aec94-f4a4-4e43-bf49-627b4c6ff476
@Override public boolean move(boolean really,int column, int row){ //vrati true, pokud je tah na pole [column][row] mozny. pokud je navic argument really = true, tah se i provede if(inRange(column, row)&& ref.isNotMine(column, row)){ Pawn backUp; Chessman ten; backUp = this; ten = ref.board[column][row]; if(row == 7 || row == 0) { Scanner inp = new Scanner(System.in); String piece; System.out.println("Povyseni pesce."); System.out.println("Zadej figurku, na kterou chces povysit."); boolean a = true; while(a) { piece = inp.nextLine(); switch(piece) { case "queen": ref.board[column][row] = new Queen(this,column,row); a = false; break; case "bishop": ref.board[column][row] = new Bishop(this,column,row); a = false; break; case "rook": ref.board[column][row] = new Rook(this,column,row); a = false; break; case "knight": ref.board[column][row] = new Knight(this,column,row); a = false; break; default: System.out.println("Chybny prikaz, opakuj."); } } } else { ref.board[column][row] = new Pawn(this,column,row); } ref.board[this.column][this.row] = null; //ref.print(); boolean b = ref.isChecked(); if(really) { if(b) { ref.board[backUp.column][backUp.row] = backUp; ref.board[column][row] = ten; //System.out.println("vracim false tudyma"); return false; } else { //System.out.println("ok, vracim true"); ref.board[column][row].moved = true; return true; } } else{ ref.board[backUp.column][backUp.row] = backUp; ref.board[column][row] = ten; //System.out.println("pr " +!b); return !b; } } else { //System.out.println("vracim false"); return false; } }
6bf2368d-5e7e-42fb-b556-76e8ab009b26
@Override public boolean inRange(int column, int row) { //vrati true, pokud je pole [row][column] v dosahu figury if (this.color == true) { //System.out.println("otrokar"); //System.out.println("oki"); if((this.column == column) && (this.ref.isFree(column,row)) && (row == this.row + 1)) { //jdu bilym dopredu //System.out.println("ok1"); return true; } if((this.column == column) && (this.ref.isFree(column,row)) && (this.ref.isFree(this.column,this.row+1)) && (row == this.row + 2) && (this.row == 1)) { //jdu bilym dopredu //System.out.println("ok2"); return true; } //System.out.println(this.ref.isEnemy(column, row)); if((Math.abs(this.column - column) == 1) && (this.ref.isEnemy(this.color,column, row)) && (row-1 == this.row)) { //System.out.println("ok3"); return true; } } else { //System.out.println("negr"); if((this.column == column) && (this.ref.isFree(column,row)) && (row == this.row - 1)) { //jdu cernym dopredu return true; } if((this.column == column) && (this.ref.isFree(column,row)) && (this.ref.isFree(this.column,this.row-1)) && (row == this.row - 2) && (this.row == 6)) { //jdu bilym dopredu return true; } //System.out.println(this.ref.isEnemy(column, row)); if((Math.abs(this.column - column) == 1) && (this.ref.isEnemy(this.color,column, row)) && (row+1 == this.row)) { return true; } } return false; }
e4aefbd0-a6bd-4389-9ed2-7168a55871bb
@Override public String toString() { if (this.color == true) { return "P"; } else { return "p"; } }
0f017da7-00c0-49bb-9266-ebc560098771
public boolean isFree(int column, int row) { //vrati true, pokud je policko [column, row] prazdne //System.out.println(column + " @ "+row); if(board[column][row] == null) { //System.out.println("true"); return true; } else { //System.out.println("false"); return false; } }
d3463bbb-55b7-48ca-89b7-40cc77389ceb
public boolean isEnemy(boolean color,int column, int row) { //vrati true, pokud je na policku [column, row] souperova figurka vuci color if(board[column][row] != null && board[column][row].getPlayer() != color) { return true; } else { return false; } }