private void verifyNameReuse(NameCache<String> cache, String s, boolean reused) { cache.put(s); int lookupCount = cache.getLookupCount(); if (reused) { // Dictionary returns non null internal value assertNotNull(cache.put(s)); // Successful lookup increments lookup count assertEquals(lookupCount + 1, cache.getLookupCount()); } else { // Dictionary returns null - since name is not in the dictionary assertNull(cache.put(s)); // Lookup count remains the same assertEquals(lookupCount, cache.getLookupCount()); } } }
private void verifyNameReuse(NameCache<String> cache, String s, boolean reused) { cache.put(s); int lookupCount = cache.getLookupCount(); if (reused) { // Dictionary returns non null internal value assertNotNull(cache.put(s)); // Successful lookup increments lookup count assertEquals(lookupCount + 1, cache.getLookupCount()); } else { // Dictionary returns null - since name is not in the dictionary assertNull(cache.put(s)); // Lookup count remains the same assertEquals(lookupCount, cache.getLookupCount()); } } }