444 |
|
try { |
445 |
|
e.setValue("A"); |
446 |
|
shouldThrow(); |
447 |
< |
} catch (Exception ok) { |
448 |
< |
} |
447 |
> |
} catch (UnsupportedOperationException success) {} |
448 |
|
e = map.pollFirstEntry(); |
449 |
|
assertNull(e); |
450 |
|
} |
471 |
|
try { |
472 |
|
e.setValue("E"); |
473 |
|
shouldThrow(); |
474 |
< |
} catch (Exception ok) { |
476 |
< |
} |
474 |
> |
} catch (UnsupportedOperationException success) {} |
475 |
|
e = map.pollLastEntry(); |
476 |
|
assertNull(e); |
477 |
|
} |
507 |
|
ConcurrentNavigableMap c = map5(); |
508 |
|
c.get(null); |
509 |
|
shouldThrow(); |
510 |
< |
} catch (NullPointerException e) {} |
510 |
> |
} catch (NullPointerException success) {} |
511 |
|
} |
512 |
|
|
513 |
|
/** |
518 |
|
ConcurrentNavigableMap c = map5(); |
519 |
|
c.containsKey(null); |
520 |
|
shouldThrow(); |
521 |
< |
} catch (NullPointerException e) {} |
521 |
> |
} catch (NullPointerException success) {} |
522 |
|
} |
523 |
|
|
524 |
|
/** |
529 |
|
ConcurrentNavigableMap c = map0(); |
530 |
|
c.containsValue(null); |
531 |
|
shouldThrow(); |
532 |
< |
} catch (NullPointerException e) {} |
532 |
> |
} catch (NullPointerException success) {} |
533 |
|
} |
534 |
|
|
535 |
|
|
541 |
|
ConcurrentNavigableMap c = map5(); |
542 |
|
c.put(null, "whatever"); |
543 |
|
shouldThrow(); |
544 |
< |
} catch (NullPointerException e) {} |
544 |
> |
} catch (NullPointerException success) {} |
545 |
|
} |
546 |
|
|
547 |
|
/** |
552 |
|
ConcurrentNavigableMap c = map5(); |
553 |
|
c.putIfAbsent(null, "whatever"); |
554 |
|
shouldThrow(); |
555 |
< |
} catch (NullPointerException e) {} |
555 |
> |
} catch (NullPointerException success) {} |
556 |
|
} |
557 |
|
|
558 |
|
/** |
563 |
|
ConcurrentNavigableMap c = map5(); |
564 |
|
c.replace(null, "whatever"); |
565 |
|
shouldThrow(); |
566 |
< |
} catch (NullPointerException e) {} |
566 |
> |
} catch (NullPointerException success) {} |
567 |
|
} |
568 |
|
|
569 |
|
/** |
574 |
|
ConcurrentNavigableMap c = map5(); |
575 |
|
c.replace(null, one, "whatever"); |
576 |
|
shouldThrow(); |
577 |
< |
} catch (NullPointerException e) {} |
577 |
> |
} catch (NullPointerException success) {} |
578 |
|
} |
579 |
|
|
580 |
|
/** |
585 |
|
ConcurrentNavigableMap c = map5(); |
586 |
|
c.remove(null); |
587 |
|
shouldThrow(); |
588 |
< |
} catch (NullPointerException e) {} |
588 |
> |
} catch (NullPointerException success) {} |
589 |
|
} |
590 |
|
|
591 |
|
/** |
596 |
|
ConcurrentNavigableMap c = map5(); |
597 |
|
c.remove(null, "whatever"); |
598 |
|
shouldThrow(); |
599 |
< |
} catch (NullPointerException e) {} |
599 |
> |
} catch (NullPointerException success) {} |
600 |
|
} |
601 |
|
|
602 |
|
/** |
603 |
|
* A deserialized map equals original |
604 |
|
*/ |
605 |
< |
public void testSerialization() { |
605 |
> |
public void testSerialization() throws Exception { |
606 |
|
ConcurrentNavigableMap q = map5(); |
607 |
|
|
608 |
< |
try { |
609 |
< |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
610 |
< |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
611 |
< |
out.writeObject(q); |
612 |
< |
out.close(); |
613 |
< |
|
614 |
< |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
615 |
< |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
616 |
< |
ConcurrentNavigableMap r = (ConcurrentNavigableMap)in.readObject(); |
617 |
< |
assertEquals(q.size(), r.size()); |
618 |
< |
assertTrue(q.equals(r)); |
621 |
< |
assertTrue(r.equals(q)); |
622 |
< |
} catch (Exception e) { |
623 |
< |
e.printStackTrace(); |
624 |
< |
unexpectedException(); |
625 |
< |
} |
608 |
> |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
609 |
> |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
610 |
> |
out.writeObject(q); |
611 |
> |
out.close(); |
612 |
> |
|
613 |
> |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
614 |
> |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
615 |
> |
ConcurrentNavigableMap r = (ConcurrentNavigableMap)in.readObject(); |
616 |
> |
assertEquals(q.size(), r.size()); |
617 |
> |
assertTrue(q.equals(r)); |
618 |
> |
assertTrue(r.equals(q)); |
619 |
|
} |
620 |
|
|
621 |
|
|
649 |
|
assertEquals(1, sm.size()); |
650 |
|
assertEquals(three, sm.firstKey()); |
651 |
|
assertEquals(three, sm.lastKey()); |
652 |
< |
assertTrue(sm.remove(three) != null); |
652 |
> |
assertEquals("C", sm.remove(three)); |
653 |
|
assertTrue(sm.isEmpty()); |
654 |
|
assertEquals(3, map.size()); |
655 |
|
} |
677 |
|
assertEquals(4, map.size()); |
678 |
|
assertEquals(0, sm.size()); |
679 |
|
assertTrue(sm.isEmpty()); |
680 |
< |
assertTrue(sm.remove(three) == null); |
680 |
> |
assertSame(sm.remove(three), null); |
681 |
|
assertEquals(4, map.size()); |
682 |
|
} |
683 |
|
|
749 |
|
SortedMap ssm = sm.tailMap(four); |
750 |
|
assertEquals(four, ssm.firstKey()); |
751 |
|
assertEquals(five, ssm.lastKey()); |
752 |
< |
assertTrue(ssm.remove(four) != null); |
752 |
> |
assertEquals("D", ssm.remove(four)); |
753 |
|
assertEquals(1, ssm.size()); |
754 |
|
assertEquals(3, sm.size()); |
755 |
|
assertEquals(4, map.size()); |
1136 |
|
try { |
1137 |
|
e.setValue("A"); |
1138 |
|
shouldThrow(); |
1139 |
< |
} catch (Exception ok) { |
1147 |
< |
} |
1139 |
> |
} catch (UnsupportedOperationException success) {} |
1140 |
|
e = map.pollFirstEntry(); |
1141 |
|
assertNull(e); |
1142 |
|
} |
1163 |
|
try { |
1164 |
|
e.setValue("E"); |
1165 |
|
shouldThrow(); |
1166 |
< |
} catch (Exception ok) { |
1175 |
< |
} |
1166 |
> |
} catch (UnsupportedOperationException success) {} |
1167 |
|
e = map.pollLastEntry(); |
1168 |
|
assertNull(e); |
1169 |
|
} |
1199 |
|
ConcurrentNavigableMap c = dmap5(); |
1200 |
|
c.get(null); |
1201 |
|
shouldThrow(); |
1202 |
< |
} catch (NullPointerException e) {} |
1202 |
> |
} catch (NullPointerException success) {} |
1203 |
|
} |
1204 |
|
|
1205 |
|
/** |
1210 |
|
ConcurrentNavigableMap c = dmap5(); |
1211 |
|
c.containsKey(null); |
1212 |
|
shouldThrow(); |
1213 |
< |
} catch (NullPointerException e) {} |
1213 |
> |
} catch (NullPointerException success) {} |
1214 |
|
} |
1215 |
|
|
1216 |
|
/** |
1221 |
|
ConcurrentNavigableMap c = dmap0(); |
1222 |
|
c.containsValue(null); |
1223 |
|
shouldThrow(); |
1224 |
< |
} catch (NullPointerException e) {} |
1224 |
> |
} catch (NullPointerException success) {} |
1225 |
|
} |
1226 |
|
|
1227 |
|
|
1233 |
|
ConcurrentNavigableMap c = dmap5(); |
1234 |
|
c.put(null, "whatever"); |
1235 |
|
shouldThrow(); |
1236 |
< |
} catch (NullPointerException e) {} |
1236 |
> |
} catch (NullPointerException success) {} |
1237 |
|
} |
1238 |
|
|
1239 |
|
/** |
1244 |
|
ConcurrentNavigableMap c = dmap5(); |
1245 |
|
c.putIfAbsent(null, "whatever"); |
1246 |
|
shouldThrow(); |
1247 |
< |
} catch (NullPointerException e) {} |
1247 |
> |
} catch (NullPointerException success) {} |
1248 |
|
} |
1249 |
|
|
1250 |
|
/** |
1255 |
|
ConcurrentNavigableMap c = dmap5(); |
1256 |
|
c.replace(null, "whatever"); |
1257 |
|
shouldThrow(); |
1258 |
< |
} catch (NullPointerException e) {} |
1258 |
> |
} catch (NullPointerException success) {} |
1259 |
|
} |
1260 |
|
|
1261 |
|
/** |
1266 |
|
ConcurrentNavigableMap c = dmap5(); |
1267 |
|
c.replace(null, m1, "whatever"); |
1268 |
|
shouldThrow(); |
1269 |
< |
} catch (NullPointerException e) {} |
1269 |
> |
} catch (NullPointerException success) {} |
1270 |
|
} |
1271 |
|
|
1272 |
|
/** |
1277 |
|
ConcurrentNavigableMap c = dmap5(); |
1278 |
|
c.remove(null); |
1279 |
|
shouldThrow(); |
1280 |
< |
} catch (NullPointerException e) {} |
1280 |
> |
} catch (NullPointerException success) {} |
1281 |
|
} |
1282 |
|
|
1283 |
|
/** |
1288 |
|
ConcurrentNavigableMap c = dmap5(); |
1289 |
|
c.remove(null, "whatever"); |
1290 |
|
shouldThrow(); |
1291 |
< |
} catch (NullPointerException e) {} |
1291 |
> |
} catch (NullPointerException success) {} |
1292 |
|
} |
1293 |
|
|
1294 |
|
/** |
1295 |
|
* A deserialized map equals original |
1296 |
|
*/ |
1297 |
< |
public void testDescendingSerialization() { |
1297 |
> |
public void testDescendingSerialization() throws Exception { |
1298 |
|
ConcurrentNavigableMap q = dmap5(); |
1299 |
|
|
1300 |
< |
try { |
1301 |
< |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
1302 |
< |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
1303 |
< |
out.writeObject(q); |
1304 |
< |
out.close(); |
1305 |
< |
|
1306 |
< |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
1307 |
< |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
1308 |
< |
ConcurrentNavigableMap r = (ConcurrentNavigableMap)in.readObject(); |
1309 |
< |
assertEquals(q.size(), r.size()); |
1310 |
< |
assertTrue(q.equals(r)); |
1320 |
< |
assertTrue(r.equals(q)); |
1321 |
< |
} catch (Exception e) { |
1322 |
< |
e.printStackTrace(); |
1323 |
< |
unexpectedException(); |
1324 |
< |
} |
1300 |
> |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
1301 |
> |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
1302 |
> |
out.writeObject(q); |
1303 |
> |
out.close(); |
1304 |
> |
|
1305 |
> |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
1306 |
> |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
1307 |
> |
ConcurrentNavigableMap r = (ConcurrentNavigableMap)in.readObject(); |
1308 |
> |
assertEquals(q.size(), r.size()); |
1309 |
> |
assertTrue(q.equals(r)); |
1310 |
> |
assertTrue(r.equals(q)); |
1311 |
|
} |
1312 |
|
|
1313 |
|
|
1328 |
– |
|
1314 |
|
/** |
1315 |
|
* subMap returns map with keys in requested range |
1316 |
|
*/ |
1340 |
|
assertEquals(1, sm.size()); |
1341 |
|
assertEquals(m3, sm.firstKey()); |
1342 |
|
assertEquals(m3, sm.lastKey()); |
1343 |
< |
assertTrue(sm.remove(m3) != null); |
1343 |
> |
assertEquals("C", sm.remove(m3)); |
1344 |
|
assertTrue(sm.isEmpty()); |
1345 |
|
assertEquals(3, map.size()); |
1346 |
|
} |
1368 |
|
assertEquals(4, map.size()); |
1369 |
|
assertEquals(0, sm.size()); |
1370 |
|
assertTrue(sm.isEmpty()); |
1371 |
< |
assertTrue(sm.remove(m3) == null); |
1371 |
> |
assertSame(sm.remove(m3), null); |
1372 |
|
assertEquals(4, map.size()); |
1373 |
|
} |
1374 |
|
|
1440 |
|
SortedMap ssm = sm.tailMap(m4); |
1441 |
|
assertEquals(m4, ssm.firstKey()); |
1442 |
|
assertEquals(m5, ssm.lastKey()); |
1443 |
< |
assertTrue(ssm.remove(m4) != null); |
1443 |
> |
assertEquals("D", ssm.remove(m4)); |
1444 |
|
assertEquals(1, ssm.size()); |
1445 |
|
assertEquals(3, sm.size()); |
1446 |
|
assertEquals(4, map.size()); |