Skip to content

Commit ed49f86

Browse files
committed
Remove obsolete code in ConcurrentReferenceHashMapTests
1 parent 12078e6 commit ed49f86

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -509,28 +509,17 @@ void shouldSupportNullReference() {
509509
map.createReferenceManager().createReference(null, 1234, null);
510510
}
511511

512-
private interface ValueFactory<V> {
513-
514-
V newValue(int k);
515-
}
516-
517512

518513
private static class TestWeakConcurrentCache<K, V> extends ConcurrentReferenceHashMap<K, V> {
519514

520515
private int supplementalHash;
521516

522517
private final LinkedList<MockReference<K, V>> queue = new LinkedList<>();
523518

524-
private boolean disableTestHooks;
525-
526519
public TestWeakConcurrentCache() {
527520
super();
528521
}
529522

530-
public void setDisableTestHooks(boolean disableTestHooks) {
531-
this.disableTestHooks = disableTestHooks;
532-
}
533-
534523
public TestWeakConcurrentCache(int initialCapacity, float loadFactor, int concurrencyLevel) {
535524
super(initialCapacity, loadFactor, concurrencyLevel);
536525
}
@@ -541,9 +530,6 @@ public TestWeakConcurrentCache(int initialCapacity, int concurrencyLevel) {
541530

542531
@Override
543532
protected int getHash(@Nullable Object o) {
544-
if (this.disableTestHooks) {
545-
return super.getHash(o);
546-
}
547533
// For testing we want more control of the hash
548534
this.supplementalHash = super.getHash(o);
549535
return (o != null ? o.hashCode() : 0);
@@ -558,16 +544,10 @@ protected ReferenceManager createReferenceManager() {
558544
return new ReferenceManager() {
559545
@Override
560546
public Reference<K, V> createReference(Entry<K, V> entry, int hash, @Nullable Reference<K, V> next) {
561-
if (TestWeakConcurrentCache.this.disableTestHooks) {
562-
return super.createReference(entry, hash, next);
563-
}
564547
return new MockReference<>(entry, hash, next, TestWeakConcurrentCache.this.queue);
565548
}
566549
@Override
567550
public Reference<K, V> pollForPurge() {
568-
if (TestWeakConcurrentCache.this.disableTestHooks) {
569-
return super.pollForPurge();
570-
}
571551
return TestWeakConcurrentCache.this.queue.isEmpty() ? null : TestWeakConcurrentCache.this.queue.removeFirst();
572552
}
573553
};

0 commit comments

Comments
 (0)