1 16 package org.apache.commons.collections.bidimap; 17 18 import java.util.ArrayList ; 19 import java.util.Arrays ; 20 import java.util.Collections ; 21 import java.util.Iterator ; 22 import java.util.List ; 23 import java.util.Map ; 24 import java.util.Set ; 25 import java.util.SortedMap ; 26 import java.util.SortedSet ; 27 import java.util.TreeMap ; 28 import java.util.TreeSet ; 29 30 import org.apache.commons.collections.BulkTest; 31 import org.apache.commons.collections.SortedBidiMap; 32 import org.apache.commons.collections.map.AbstractTestSortedMap; 33 34 42 public abstract class AbstractTestSortedBidiMap extends AbstractTestOrderedBidiMap { 43 44 protected List sortedKeys = new ArrayList (); 45 protected List sortedValues = new ArrayList (); 46 protected SortedSet sortedNewValues = new TreeSet (); 47 48 public AbstractTestSortedBidiMap(String testName) { 49 super(testName); 50 sortedKeys.addAll(Arrays.asList(getSampleKeys())); 51 Collections.sort(sortedKeys); 52 sortedKeys = Collections.unmodifiableList(sortedKeys); 53 54 Map map = new TreeMap (); 55 for (int i = 0; i < getSampleKeys().length; i++) { 56 map.put(getSampleKeys()[i], getSampleValues()[i]); 57 } 58 sortedValues.addAll(map.values()); 59 sortedValues = Collections.unmodifiableList(sortedValues); 60 61 sortedNewValues.addAll(Arrays.asList(getNewSampleValues())); 62 } 63 64 public AbstractTestSortedBidiMap() { 65 super(); 66 sortedKeys.addAll(Arrays.asList(getSampleValues())); 67 Collections.sort(sortedKeys); 68 sortedKeys = Collections.unmodifiableList(sortedKeys); 69 70 Map map = new TreeMap (); 71 for (int i = 0; i < getSampleKeys().length; i++) { 72 map.put(getSampleValues()[i], getSampleKeys()[i]); 73 } 74 sortedValues.addAll(map.values()); 75 sortedValues = Collections.unmodifiableList(sortedValues); 76 77 sortedNewValues.addAll(Arrays.asList(getNewSampleValues())); 78 } 79 80 public boolean isAllowNullKey() { 82 return false; 83 } 84 public boolean isAllowNullValue() { 85 return false; 86 } 87 public Map makeConfirmedMap() { 88 return new TreeMap (); 89 } 90 91 public void testBidiHeadMapContains() { 94 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 96 Iterator it = sm.keySet().iterator(); 97 Object first = it.next(); 98 Object toKey = it.next(); 99 Object second = it.next(); 100 Object firstValue = sm.get(first); 101 Object secondValue = sm.get(second); 102 103 SortedMap head = sm.headMap(toKey); 104 assertEquals(1, head.size()); 105 assertEquals(true, sm.containsKey(first)); 106 assertEquals(true, head.containsKey(first)); 107 assertEquals(true, sm.containsValue(firstValue)); 108 assertEquals(true, head.containsValue(firstValue)); 109 assertEquals(true, sm.containsKey(second)); 110 assertEquals(false, head.containsKey(second)); 111 assertEquals(true, sm.containsValue(secondValue)); 112 assertEquals(false, head.containsValue(secondValue)); 113 } 114 115 public void testBidiClearByHeadMap() { 117 if (isRemoveSupported() == false) return; 118 119 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 121 Iterator it = sm.keySet().iterator(); 122 Object first = it.next(); 123 Object second = it.next(); 124 Object toKey = it.next(); 125 126 Object firstValue = sm.get(first); 127 Object secondValue = sm.get(second); 128 Object toKeyValue = sm.get(toKey); 129 130 SortedMap sub = sm.headMap(toKey); 131 int size = sm.size(); 132 assertEquals(2, sub.size()); 133 sub.clear(); 134 assertEquals(0, sub.size()); 135 assertEquals(size - 2, sm.size()); 136 assertEquals(size - 2, sm.inverseBidiMap().size()); 137 138 assertEquals(false, sm.containsKey(first)); 139 assertEquals(false, sm.containsValue(firstValue)); 140 assertEquals(false, sm.inverseBidiMap().containsKey(firstValue)); 141 assertEquals(false, sm.inverseBidiMap().containsValue(first)); 142 assertEquals(false, sub.containsKey(first)); 143 assertEquals(false, sub.containsValue(firstValue)); 144 145 assertEquals(false, sm.containsKey(second)); 146 assertEquals(false, sm.containsValue(secondValue)); 147 assertEquals(false, sm.inverseBidiMap().containsKey(secondValue)); 148 assertEquals(false, sm.inverseBidiMap().containsValue(second)); 149 assertEquals(false, sub.containsKey(second)); 150 assertEquals(false, sub.containsValue(secondValue)); 151 152 assertEquals(true, sm.containsKey(toKey)); 153 assertEquals(true, sm.containsValue(toKeyValue)); 154 assertEquals(true, sm.inverseBidiMap().containsKey(toKeyValue)); 155 assertEquals(true, sm.inverseBidiMap().containsValue(toKey)); 156 assertEquals(false, sub.containsKey(toKey)); 157 assertEquals(false, sub.containsValue(toKeyValue)); 158 } 159 160 public void testBidiRemoveByHeadMap() { 162 if (isRemoveSupported() == false) return; 163 164 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 166 Iterator it = sm.keySet().iterator(); 167 Object first = it.next(); 168 Object second = it.next(); 169 Object toKey = it.next(); 170 171 int size = sm.size(); 172 SortedMap sub = sm.headMap(toKey); 173 assertEquals(2, sub.size()); 174 assertEquals(true, sm.containsKey(first)); 175 assertEquals(true, sub.containsKey(first)); 176 assertEquals(true, sm.containsKey(second)); 177 assertEquals(true, sub.containsKey(second)); 178 179 Object firstValue = sub.remove(first); 180 assertEquals(1, sub.size()); 181 assertEquals(size - 1, sm.size()); 182 assertEquals(size - 1, sm.inverseBidiMap().size()); 183 assertEquals(false, sm.containsKey(first)); 184 assertEquals(false, sm.containsValue(firstValue)); 185 assertEquals(false, sm.inverseBidiMap().containsKey(firstValue)); 186 assertEquals(false, sm.inverseBidiMap().containsValue(first)); 187 assertEquals(false, sub.containsKey(first)); 188 assertEquals(false, sub.containsValue(firstValue)); 189 190 Object secondValue = sub.remove(second); 191 assertEquals(0, sub.size()); 192 assertEquals(size - 2, sm.size()); 193 assertEquals(size - 2, sm.inverseBidiMap().size()); 194 assertEquals(false, sm.containsKey(second)); 195 assertEquals(false, sm.containsValue(secondValue)); 196 assertEquals(false, sm.inverseBidiMap().containsKey(secondValue)); 197 assertEquals(false, sm.inverseBidiMap().containsValue(second)); 198 assertEquals(false, sub.containsKey(second)); 199 assertEquals(false, sub.containsValue(secondValue)); 200 } 201 202 public void testBidiRemoveByHeadMapEntrySet() { 204 if (isRemoveSupported() == false) return; 205 206 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 208 Iterator it = sm.keySet().iterator(); 209 Object first = it.next(); 210 Object second = it.next(); 211 Object toKey = it.next(); 212 213 int size = sm.size(); 214 SortedMap sub = sm.headMap(toKey); 215 Set set = sub.entrySet(); 216 assertEquals(2, sub.size()); 217 assertEquals(2, set.size()); 218 219 Iterator it2 = set.iterator(); 220 Map.Entry firstEntry = cloneMapEntry((Map.Entry ) it2.next()); 221 Map.Entry secondEntry = cloneMapEntry((Map.Entry ) it2.next()); 222 assertEquals(true, sm.containsKey(first)); 223 assertEquals(true, sub.containsKey(first)); 224 assertEquals(true, set.contains(firstEntry)); 225 assertEquals(true, sm.containsKey(second)); 226 assertEquals(true, sub.containsKey(second)); 227 assertEquals(true, set.contains(secondEntry)); 228 229 set.remove(firstEntry); 230 assertEquals(1, sub.size()); 231 assertEquals(size - 1, sm.size()); 232 assertEquals(size - 1, sm.inverseBidiMap().size()); 233 assertEquals(false, sm.containsKey(firstEntry.getKey())); 234 assertEquals(false, sm.containsValue(firstEntry.getValue())); 235 assertEquals(false, sm.inverseBidiMap().containsKey(firstEntry.getValue())); 236 assertEquals(false, sm.inverseBidiMap().containsValue(firstEntry.getKey())); 237 assertEquals(false, sub.containsKey(firstEntry.getKey())); 238 assertEquals(false, sub.containsValue(firstEntry.getValue())); 239 assertEquals(false, set.contains(firstEntry)); 240 241 set.remove(secondEntry); 242 assertEquals(0, sub.size()); 243 assertEquals(size - 2, sm.size()); 244 assertEquals(size - 2, sm.inverseBidiMap().size()); 245 assertEquals(false, sm.containsKey(secondEntry.getKey())); 246 assertEquals(false, sm.containsValue(secondEntry.getValue())); 247 assertEquals(false, sm.inverseBidiMap().containsKey(secondEntry.getValue())); 248 assertEquals(false, sm.inverseBidiMap().containsValue(secondEntry.getKey())); 249 assertEquals(false, sub.containsKey(secondEntry.getKey())); 250 assertEquals(false, sub.containsValue(secondEntry.getValue())); 251 assertEquals(false, set.contains(secondEntry)); 252 } 253 254 public void testBidiTailMapContains() { 257 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 259 Iterator it = sm.keySet().iterator(); 260 Object first = it.next(); 261 Object fromKey = it.next(); 262 Object second = it.next(); 263 Object firstValue = sm.get(first); 264 Object fromKeyValue = sm.get(fromKey); 265 Object secondValue = sm.get(second); 266 267 SortedMap sub = sm.tailMap(fromKey); 268 assertEquals(sm.size() - 1, sub.size()); 269 assertEquals(true, sm.containsKey(first)); 270 assertEquals(false, sub.containsKey(first)); 271 assertEquals(true, sm.containsValue(firstValue)); 272 assertEquals(false, sub.containsValue(firstValue)); 273 assertEquals(true, sm.containsKey(fromKey)); 274 assertEquals(true, sub.containsKey(fromKey)); 275 assertEquals(true, sm.containsValue(fromKeyValue)); 276 assertEquals(true, sub.containsValue(fromKeyValue)); 277 assertEquals(true, sm.containsKey(second)); 278 assertEquals(true, sub.containsKey(second)); 279 assertEquals(true, sm.containsValue(secondValue)); 280 assertEquals(true, sub.containsValue(secondValue)); 281 } 282 283 public void testBidiClearByTailMap() { 285 if (isRemoveSupported() == false) return; 286 287 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 289 Iterator it = sm.keySet().iterator(); 290 it.next(); 291 it.next(); 292 Object first = it.next(); 293 Object fromKey = it.next(); 294 Object second = it.next(); 295 296 Object firstValue = sm.get(first); 297 Object fromKeyValue = sm.get(fromKey); 298 Object secondValue = sm.get(second); 299 300 SortedMap sub = sm.tailMap(fromKey); 301 int size = sm.size(); 302 assertEquals(size - 3, sub.size()); 303 sub.clear(); 304 assertEquals(0, sub.size()); 305 assertEquals(3, sm.size()); 306 assertEquals(3, sm.inverseBidiMap().size()); 307 308 assertEquals(true, sm.containsKey(first)); 309 assertEquals(true, sm.containsValue(firstValue)); 310 assertEquals(true, sm.inverseBidiMap().containsKey(firstValue)); 311 assertEquals(true, sm.inverseBidiMap().containsValue(first)); 312 assertEquals(false, sub.containsKey(first)); 313 assertEquals(false, sub.containsValue(firstValue)); 314 315 assertEquals(false, sm.containsKey(fromKey)); 316 assertEquals(false, sm.containsValue(fromKeyValue)); 317 assertEquals(false, sm.inverseBidiMap().containsKey(fromKeyValue)); 318 assertEquals(false, sm.inverseBidiMap().containsValue(fromKey)); 319 assertEquals(false, sub.containsKey(fromKey)); 320 assertEquals(false, sub.containsValue(fromKeyValue)); 321 322 assertEquals(false, sm.containsKey(second)); 323 assertEquals(false, sm.containsValue(secondValue)); 324 assertEquals(false, sm.inverseBidiMap().containsKey(secondValue)); 325 assertEquals(false, sm.inverseBidiMap().containsValue(second)); 326 assertEquals(false, sub.containsKey(second)); 327 assertEquals(false, sub.containsValue(secondValue)); 328 } 329 330 public void testBidiRemoveByTailMap() { 332 if (isRemoveSupported() == false) return; 333 334 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 336 Iterator it = sm.keySet().iterator(); 337 it.next(); 338 it.next(); 339 Object fromKey = it.next(); 340 Object first = it.next(); 341 Object second = it.next(); 342 343 int size = sm.size(); 344 SortedMap sub = sm.tailMap(fromKey); 345 assertEquals(true, sm.containsKey(first)); 346 assertEquals(true, sub.containsKey(first)); 347 assertEquals(true, sm.containsKey(second)); 348 assertEquals(true, sub.containsKey(second)); 349 350 Object firstValue = sub.remove(first); 351 assertEquals(size - 3, sub.size()); 352 assertEquals(size - 1, sm.size()); 353 assertEquals(size - 1, sm.inverseBidiMap().size()); 354 assertEquals(false, sm.containsKey(first)); 355 assertEquals(false, sm.containsValue(firstValue)); 356 assertEquals(false, sm.inverseBidiMap().containsKey(firstValue)); 357 assertEquals(false, sm.inverseBidiMap().containsValue(first)); 358 assertEquals(false, sub.containsKey(first)); 359 assertEquals(false, sub.containsValue(firstValue)); 360 361 Object secondValue = sub.remove(second); 362 assertEquals(size - 4, sub.size()); 363 assertEquals(size - 2, sm.size()); 364 assertEquals(size - 2, sm.inverseBidiMap().size()); 365 assertEquals(false, sm.containsKey(second)); 366 assertEquals(false, sm.containsValue(secondValue)); 367 assertEquals(false, sm.inverseBidiMap().containsKey(secondValue)); 368 assertEquals(false, sm.inverseBidiMap().containsValue(second)); 369 assertEquals(false, sub.containsKey(second)); 370 assertEquals(false, sub.containsValue(secondValue)); 371 } 372 373 public void testBidiRemoveByTailMapEntrySet() { 375 if (isRemoveSupported() == false) return; 376 377 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 379 Iterator it = sm.keySet().iterator(); 380 it.next(); 381 it.next(); 382 Object fromKey = it.next(); 383 Object first = it.next(); 384 Object second = it.next(); 385 386 int size = sm.size(); 387 SortedMap sub = sm.tailMap(fromKey); 388 Set set = sub.entrySet(); 389 Iterator it2 = set.iterator(); 390 Object fromEntry = it2.next(); 391 Map.Entry firstEntry = cloneMapEntry((Map.Entry ) it2.next()); 392 Map.Entry secondEntry = cloneMapEntry((Map.Entry ) it2.next()); 393 assertEquals(true, sm.containsKey(first)); 394 assertEquals(true, sub.containsKey(first)); 395 assertEquals(true, set.contains(firstEntry)); 396 assertEquals(true, sm.containsKey(second)); 397 assertEquals(true, sub.containsKey(second)); 398 assertEquals(true, set.contains(secondEntry)); 399 400 set.remove(firstEntry); 401 assertEquals(size - 3, sub.size()); 402 assertEquals(size - 1, sm.size()); 403 assertEquals(size - 1, sm.inverseBidiMap().size()); 404 assertEquals(false, sm.containsKey(firstEntry.getKey())); 405 assertEquals(false, sm.containsValue(firstEntry.getValue())); 406 assertEquals(false, sm.inverseBidiMap().containsKey(firstEntry.getValue())); 407 assertEquals(false, sm.inverseBidiMap().containsValue(firstEntry.getKey())); 408 assertEquals(false, sub.containsKey(firstEntry.getKey())); 409 assertEquals(false, sub.containsValue(firstEntry.getValue())); 410 assertEquals(false, set.contains(firstEntry)); 411 412 set.remove(secondEntry); 413 assertEquals(size - 4, sub.size()); 414 assertEquals(size - 2, sm.size()); 415 assertEquals(size - 2, sm.inverseBidiMap().size()); 416 assertEquals(false, sm.containsKey(secondEntry.getKey())); 417 assertEquals(false, sm.containsValue(secondEntry.getValue())); 418 assertEquals(false, sm.inverseBidiMap().containsKey(secondEntry.getValue())); 419 assertEquals(false, sm.inverseBidiMap().containsValue(secondEntry.getKey())); 420 assertEquals(false, sub.containsKey(secondEntry.getKey())); 421 assertEquals(false, sub.containsValue(secondEntry.getValue())); 422 assertEquals(false, set.contains(secondEntry)); 423 } 424 425 public void testBidiSubMapContains() { 428 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 430 Iterator it = sm.keySet().iterator(); 431 Object first = it.next(); 432 Object fromKey = it.next(); 433 Object second = it.next(); 434 Object toKey = it.next(); 435 Object third = it.next(); 436 Object firstValue = sm.get(first); 437 Object fromKeyValue = sm.get(fromKey); 438 Object secondValue = sm.get(second); 439 Object thirdValue = sm.get(third); 440 441 SortedMap sub = sm.subMap(fromKey, toKey); 442 assertEquals(2, sub.size()); 443 assertEquals(true, sm.containsKey(first)); 444 assertEquals(false, sub.containsKey(first)); 445 assertEquals(true, sm.containsValue(firstValue)); 446 assertEquals(false, sub.containsValue(firstValue)); 447 assertEquals(true, sm.containsKey(fromKey)); 448 assertEquals(true, sub.containsKey(fromKey)); 449 assertEquals(true, sm.containsValue(fromKeyValue)); 450 assertEquals(true, sub.containsValue(fromKeyValue)); 451 assertEquals(true, sm.containsKey(second)); 452 assertEquals(true, sub.containsKey(second)); 453 assertEquals(true, sm.containsValue(secondValue)); 454 assertEquals(true, sub.containsValue(secondValue)); 455 assertEquals(true, sm.containsKey(third)); 456 assertEquals(false, sub.containsKey(third)); 457 assertEquals(true, sm.containsValue(thirdValue)); 458 assertEquals(false, sub.containsValue(thirdValue)); 459 } 460 461 public void testBidiClearBySubMap() { 463 if (isRemoveSupported() == false) return; 464 465 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 467 Iterator it = sm.keySet().iterator(); 468 it.next(); 469 Object fromKey = it.next(); 470 Object first = it.next(); 471 Object second = it.next(); 472 Object toKey = it.next(); 473 474 Object fromKeyValue = sm.get(fromKey); 475 Object firstValue = sm.get(first); 476 Object secondValue = sm.get(second); 477 Object toKeyValue = sm.get(toKey); 478 479 SortedMap sub = sm.subMap(fromKey, toKey); 480 int size = sm.size(); 481 assertEquals(3, sub.size()); 482 sub.clear(); 483 assertEquals(0, sub.size()); 484 assertEquals(size - 3, sm.size()); 485 assertEquals(size - 3, sm.inverseBidiMap().size()); 486 487 assertEquals(false, sm.containsKey(fromKey)); 488 assertEquals(false, sm.containsValue(fromKeyValue)); 489 assertEquals(false, sm.inverseBidiMap().containsKey(fromKeyValue)); 490 assertEquals(false, sm.inverseBidiMap().containsValue(fromKey)); 491 assertEquals(false, sub.containsKey(fromKey)); 492 assertEquals(false, sub.containsValue(fromKeyValue)); 493 494 assertEquals(false, sm.containsKey(first)); 495 assertEquals(false, sm.containsValue(firstValue)); 496 assertEquals(false, sm.inverseBidiMap().containsKey(firstValue)); 497 assertEquals(false, sm.inverseBidiMap().containsValue(first)); 498 assertEquals(false, sub.containsKey(first)); 499 assertEquals(false, sub.containsValue(firstValue)); 500 501 assertEquals(false, sm.containsKey(second)); 502 assertEquals(false, sm.containsValue(secondValue)); 503 assertEquals(false, sm.inverseBidiMap().containsKey(secondValue)); 504 assertEquals(false, sm.inverseBidiMap().containsValue(second)); 505 assertEquals(false, sub.containsKey(second)); 506 assertEquals(false, sub.containsValue(secondValue)); 507 508 assertEquals(true, sm.containsKey(toKey)); 509 assertEquals(true, sm.containsValue(toKeyValue)); 510 assertEquals(true, sm.inverseBidiMap().containsKey(toKeyValue)); 511 assertEquals(true, sm.inverseBidiMap().containsValue(toKey)); 512 assertEquals(false, sub.containsKey(toKey)); 513 assertEquals(false, sub.containsValue(toKeyValue)); 514 } 515 516 public void testBidiRemoveBySubMap() { 518 if (isRemoveSupported() == false) return; 519 520 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 522 Iterator it = sm.keySet().iterator(); 523 it.next(); 524 it.next(); 525 Object fromKey = it.next(); 526 Object first = it.next(); 527 Object second = it.next(); 528 Object toKey = it.next(); 529 530 int size = sm.size(); 531 SortedMap sub = sm.subMap(fromKey, toKey); 532 assertEquals(true, sm.containsKey(first)); 533 assertEquals(true, sub.containsKey(first)); 534 assertEquals(true, sm.containsKey(second)); 535 assertEquals(true, sub.containsKey(second)); 536 537 Object firstValue = sub.remove(first); 538 assertEquals(2, sub.size()); 539 assertEquals(size - 1, sm.size()); 540 assertEquals(size - 1, sm.inverseBidiMap().size()); 541 assertEquals(false, sm.containsKey(first)); 542 assertEquals(false, sm.containsValue(firstValue)); 543 assertEquals(false, sm.inverseBidiMap().containsKey(firstValue)); 544 assertEquals(false, sm.inverseBidiMap().containsValue(first)); 545 assertEquals(false, sub.containsKey(first)); 546 assertEquals(false, sub.containsValue(firstValue)); 547 548 Object secondValue = sub.remove(second); 549 assertEquals(1, sub.size()); 550 assertEquals(size - 2, sm.size()); 551 assertEquals(size - 2, sm.inverseBidiMap().size()); 552 assertEquals(false, sm.containsKey(second)); 553 assertEquals(false, sm.containsValue(secondValue)); 554 assertEquals(false, sm.inverseBidiMap().containsKey(secondValue)); 555 assertEquals(false, sm.inverseBidiMap().containsValue(second)); 556 assertEquals(false, sub.containsKey(second)); 557 assertEquals(false, sub.containsValue(secondValue)); 558 } 559 560 public void testBidiRemoveBySubMapEntrySet() { 562 if (isRemoveSupported() == false) return; 563 564 SortedBidiMap sm = (SortedBidiMap) makeFullMap(); 566 Iterator it = sm.keySet().iterator(); 567 it.next(); 568 it.next(); 569 Object fromKey = it.next(); 570 Object first = it.next(); 571 Object second = it.next(); 572 Object toKey = it.next(); 573 574 int size = sm.size(); 575 SortedMap sub = sm.subMap(fromKey, toKey); 576 Set set = sub.entrySet(); 577 assertEquals(3, set.size()); 578 Iterator it2 = set.iterator(); 579 Object fromEntry = it2.next(); 580 Map.Entry firstEntry = cloneMapEntry((Map.Entry ) it2.next()); 581 Map.Entry secondEntry = cloneMapEntry((Map.Entry ) it2.next()); 582 assertEquals(true, sm.containsKey(first)); 583 assertEquals(true, sub.containsKey(first)); 584 assertEquals(true, set.contains(firstEntry)); 585 assertEquals(true, sm.containsKey(second)); 586 assertEquals(true, sub.containsKey(second)); 587 assertEquals(true, set.contains(secondEntry)); 588 589 set.remove(firstEntry); 590 assertEquals(2, sub.size()); 591 assertEquals(size - 1, sm.size()); 592 assertEquals(size - 1, sm.inverseBidiMap().size()); 593 assertEquals(false, sm.containsKey(firstEntry.getKey())); 594 assertEquals(false, sm.containsValue(firstEntry.getValue())); 595 assertEquals(false, sm.inverseBidiMap().containsKey(firstEntry.getValue())); 596 assertEquals(false, sm.inverseBidiMap().containsValue(firstEntry.getKey())); 597 assertEquals(false, sub.containsKey(firstEntry.getKey())); 598 assertEquals(false, sub.containsValue(firstEntry.getValue())); 599 assertEquals(false, set.contains(firstEntry)); 600 601 set.remove(secondEntry); 602 assertEquals(1, sub.size()); 603 assertEquals(size - 2, sm.size()); 604 assertEquals(size - 2, sm.inverseBidiMap().size()); 605 assertEquals(false, sm.containsKey(secondEntry.getKey())); 606 assertEquals(false, sm.containsValue(secondEntry.getValue())); 607 assertEquals(false, sm.inverseBidiMap().containsKey(secondEntry.getValue())); 608 assertEquals(false, sm.inverseBidiMap().containsValue(secondEntry.getKey())); 609 assertEquals(false, sub.containsKey(secondEntry.getKey())); 610 assertEquals(false, sub.containsValue(secondEntry.getValue())); 611 assertEquals(false, set.contains(secondEntry)); 612 } 613 614 public BulkTest bulkTestHeadMap() { 616 return new AbstractTestSortedMap.TestHeadMap(this); 617 } 618 619 public BulkTest bulkTestTailMap() { 620 return new AbstractTestSortedMap.TestTailMap(this); 621 } 622 623 public BulkTest bulkTestSubMap() { 624 return new AbstractTestSortedMap.TestSubMap(this); 625 } 626 627 } 628 | Popular Tags |