Change GeolocationCacheTest

This commit is contained in:
Fuzzlemann 2017-08-14 23:40:20 +02:00
parent bdb4b4ffbe
commit 521950804c

View File

@ -56,7 +56,10 @@ public class GeolocationCacheTest {
public void testCaching() throws Exception { public void testCaching() throws Exception {
TestInit.init(); TestInit.init();
for (String ip : ipsToCountries.keySet()) { for (Map.Entry<String, String> entry : ipsToCountries.entrySet()) {
String ip = entry.getKey();
String expIp = entry.getValue();
String countryFirstCall = GeolocationCacheHandler.getUncachedCountry(ip); String countryFirstCall = GeolocationCacheHandler.getUncachedCountry(ip);
assertFalse(GeolocationCacheHandler.isCached(ip)); assertFalse(GeolocationCacheHandler.isCached(ip));
@ -64,7 +67,10 @@ public class GeolocationCacheTest {
assertTrue(GeolocationCacheHandler.isCached(ip)); assertTrue(GeolocationCacheHandler.isCached(ip));
String countryThirdCall = GeolocationCacheHandler.getCachedCountry(ip); String countryThirdCall = GeolocationCacheHandler.getCachedCountry(ip);
assertEquals(countryFirstCall, countrySecondCall, countryThirdCall);
assertEquals(countryFirstCall, countrySecondCall);
assertEquals(countrySecondCall, countryThirdCall);
assertEquals(countryThirdCall, expIp);
} }
} }
} }