mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-23 01:27:42 +01:00
Fix ISO code for South Korea and North Korea
Affects issues: - Fixed #2259
This commit is contained in:
parent
957b7f400f
commit
019b59128f
@ -19,9 +19,16 @@ package com.djrapitops.plan.delivery.rendering.json.graphs.special;
|
||||
import com.djrapitops.plan.delivery.domain.mutators.SessionsMutator;
|
||||
import com.djrapitops.plan.gathering.domain.FinishedSession;
|
||||
import com.djrapitops.plan.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.storage.file.PlanFiles;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorContext;
|
||||
import com.djrapitops.plan.utilities.logging.ErrorLogger;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -33,12 +40,19 @@ import java.util.Map;
|
||||
@Singleton
|
||||
public class SpecialGraphFactory {
|
||||
|
||||
private final PlanFiles files;
|
||||
private final PlanConfig config;
|
||||
private final Gson gson;
|
||||
private final ErrorLogger errorLogger;
|
||||
|
||||
private Map<String, String> geoCodes = null;
|
||||
|
||||
@Inject
|
||||
public SpecialGraphFactory(PlanConfig config) {
|
||||
// Inject Constructor.
|
||||
public SpecialGraphFactory(PlanFiles files, PlanConfig config, Gson gson, ErrorLogger errorLogger) {
|
||||
this.files = files;
|
||||
this.config = config;
|
||||
this.gson = gson;
|
||||
this.errorLogger = errorLogger;
|
||||
}
|
||||
|
||||
public PunchCard punchCard(List<FinishedSession> sessions) {
|
||||
@ -50,7 +64,18 @@ public class SpecialGraphFactory {
|
||||
}
|
||||
|
||||
public WorldMap worldMap(Map<String, Integer> geolocationCounts) {
|
||||
return new WorldMap(geolocationCounts);
|
||||
if (geoCodes == null) prepareGeocodes();
|
||||
return new WorldMap(geoCodes, geolocationCounts);
|
||||
}
|
||||
|
||||
private void prepareGeocodes() {
|
||||
try {
|
||||
geoCodes = files.getResourceFromJar("geocodes.json")
|
||||
.asParsed(gson, new TypeToken<Map<String, String>>() {});
|
||||
} catch (IOException e) {
|
||||
geoCodes = new HashMap<>();
|
||||
errorLogger.error(e, ErrorContext.builder().whatToDo("Failed to read geocodes.json from jar. Try restarting the server.").build());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -31,33 +31,20 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class WorldMap {
|
||||
|
||||
private final Map<String, String> geoCodes;
|
||||
private final Map<String, Integer> geoCodeCounts;
|
||||
|
||||
WorldMap(PlayersMutator mutator) {
|
||||
WorldMap(Map<String, String> geoCodes, PlayersMutator mutator) {
|
||||
this.geoCodes = geoCodes;
|
||||
this.geoCodeCounts = toGeoCodeCounts(mutator.getGeolocations());
|
||||
}
|
||||
|
||||
WorldMap(Map<String, Integer> geolocationCounts) {
|
||||
WorldMap(Map<String, String> geoCodes, Map<String, Integer> geolocationCounts) {
|
||||
this.geoCodes = geoCodes;
|
||||
this.geoCodeCounts = toGeoCodeCounts(geolocationCounts);
|
||||
}
|
||||
|
||||
private static Map<String, String> getGeoCodes() {
|
||||
Map<String, String> geoCodes = new HashMap<>();
|
||||
// Countries & Codes have been copied from a iso-a3 specification file.
|
||||
// Each index corresponds to each code.
|
||||
String[] countries = new String[]{"Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas, The", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "British Virgin Islands", "Brunei", "Bulgaria", "Burkina Faso", "Burma", "Burundi", "Cabo Verde", "Cambodia", "Cameroon", "Canada", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo, Democratic Republic of the", "Congo, Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Curacao", "Cyprus", "Czech Republic", "Czechia", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Islas Malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Polynesia", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guam", "Guatemala", "Guernsey", "Guinea-Bissau", "Guinea", "Guyana", "Haiti", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Isle of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "North Korea", "South Korea", "Kosovo", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia, Federated States of", "Moldova", "Monaco", "Mongolia", "Montenegro", "Morocco", "Mozambique", "Namibia", "Nepal", "Netherlands", "New Caledonia", "New Zealand", "Nicaragua", "Nigeria", "Niger", "Niue", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Puerto Rico", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Sint Maarten", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Timor-Leste", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands", "West Bank", "Yemen", "Zambia", "Zimbabwe"};
|
||||
String[] codes = new String[]{"AFG", "ALB", "DZA", "ASM", "AND", "AGO", "AIA", "ATG", "ARG", "ARM", "ABW", "AUS", "AUT", "AZE", "BHM", "BHR", "BGD", "BRB", "BLR", "BEL", "BLZ", "BEN", "BMU", "BTN", "BOL", "BIH", "BWA", "BRA", "VGB", "BRN", "BGR", "BFA", "MMR", "BDI", "CPV", "KHM", "CMR", "CAN", "CYM", "CAF", "TCD", "CHL", "CHN", "COL", "COM", "COD", "COG", "COK", "CRI", "CIV", "HRV", "CUB", "CUW", "CYP", "CZE", "CZE", "DNK", "DJI", "DMA", "DOM", "ECU", "EGY", "SLV", "GNQ", "ERI", "EST", "ETH", "FLK", "FRO", "FJI", "FIN", "FRA", "PYF", "GAB", "GMB", "GEO", "DEU", "GHA", "GIB", "GRC", "GRL", "GRD", "GUM", "GTM", "GGY", "GNB", "GIN", "GUY", "HTI", "HND", "HKG", "HUN", "ISL", "IND", "IDN", "IRN", "IRQ", "IRL", "IMN", "ISR", "ITA", "JAM", "JPN", "JEY", "JOR", "KAZ", "KEN", "KIR", "KOR", "PRK", "KSV", "KWT", "KGZ", "LAO", "LVA", "LBN", "LSO", "LBR", "LBY", "LIE", "LTU", "LUX", "MAC", "MKD", "MDG", "MWI", "MYS", "MDV", "MLI", "MLT", "MHL", "MRT", "MUS", "MEX", "FSM", "MDA", "MCO", "MNG", "MNE", "MAR", "MOZ", "NAM", "NPL", "NLD", "NCL", "NZL", "NIC", "NGA", "NER", "NIU", "MNP", "NOR", "OMN", "PAK", "PLW", "PAN", "PNG", "PRY", "PER", "PHL", "POL", "PRT", "PRI", "QAT", "ROU", "RUS", "RWA", "KNA", "LCA", "MAF", "SPM", "VCT", "WSM", "SMR", "STP", "SAU", "SEN", "SRB", "SYC", "SLE", "SGP", "SXM", "SVK", "SVN", "SLB", "SOM", "ZAF", "SSD", "ESP", "LKA", "SDN", "SUR", "SWZ", "SWE", "CHE", "SYR", "TWN", "TJK", "TZA", "THA", "TLS", "TGO", "TON", "TTO", "TUN", "TUR", "TKM", "TUV", "UGA", "UKR", "ARE", "GBR", "USA", "URY", "UZB", "VUT", "VEN", "VNM", "VGB", "WBG", "YEM", "ZMB", "ZWE"};
|
||||
for (int i = 0; i < countries.length; i++) {
|
||||
String country = countries[i];
|
||||
String countryCode = codes[i];
|
||||
|
||||
geoCodes.put(country.toLowerCase(), countryCode);
|
||||
}
|
||||
return geoCodes;
|
||||
}
|
||||
|
||||
private Map<String, Integer> toGeoCodeCounts(Map<String, Integer> geolocationCounts) {
|
||||
Map<String, String> geoCodes = getGeoCodes();
|
||||
Map<String, Integer> codeCounts = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Integer> entry : geolocationCounts.entrySet()) {
|
||||
@ -75,7 +62,6 @@ public class WorldMap {
|
||||
|
||||
private Map<String, Integer> toGeoCodeCounts(List<String> geoLocations) {
|
||||
Map<String, Integer> codeCounts = new HashMap<>();
|
||||
Map<String, String> geoCodes = getGeoCodes();
|
||||
|
||||
for (String geoLocation : geoLocations) {
|
||||
String countryCode = geoCodes.get(geoLocation.toLowerCase());
|
||||
|
@ -66,13 +66,13 @@ public class ConfigWriter {
|
||||
if (outputPath == null) throw new IllegalStateException("Output path was null.");
|
||||
|
||||
ConfigNode storedParent = writing.parent;
|
||||
writing.updateParent(null);
|
||||
writing.updateParent(null); // Ensure that the node is written as the root node (Paths match)
|
||||
|
||||
Path dir = outputPath.getParent();
|
||||
if (!Files.isSymbolicLink(dir)) Files.createDirectories(dir);
|
||||
Files.write(outputPath, createLines(writing), StandardCharsets.UTF_8, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
|
||||
|
||||
writing.updateParent(storedParent);
|
||||
writing.updateParent(storedParent); // Restore state of the config node
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,12 +112,12 @@ public class ServerQueries {
|
||||
|
||||
public static Query<Optional<Server>> fetchServerMatchingIdentifier(String identifier) {
|
||||
String sql = SELECT + '*' + FROM + ServerTable.TABLE_NAME +
|
||||
" WHERE (LOWER(" + ServerTable.SERVER_UUID + ") LIKE LOWER(?)" +
|
||||
WHERE + "(LOWER(" + ServerTable.SERVER_UUID + ") LIKE LOWER(?)" +
|
||||
OR + "LOWER(" + ServerTable.NAME + ") LIKE LOWER(?)" +
|
||||
OR + ServerTable.SERVER_ID + "=?" +
|
||||
OR + ServerTable.SERVER_ID + "=?)" +
|
||||
AND + ServerTable.INSTALLED + "=?" +
|
||||
" LIMIT 1";
|
||||
LIMIT + '1';
|
||||
return new QueryStatement<Optional<Server>>(sql) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
@ -149,7 +149,7 @@ public class ServerQueries {
|
||||
String sql = SELECT + '*' + FROM + ServerTable.TABLE_NAME +
|
||||
WHERE + ServerTable.INSTALLED + "=?" +
|
||||
AND + ServerTable.PROXY + "=?" +
|
||||
" LIMIT 1";
|
||||
LIMIT + '1';
|
||||
return new QueryStatement<Optional<Server>>(sql) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
@ -213,12 +213,12 @@ public class ServerQueries {
|
||||
if (identifier.isEmpty()) return db -> Collections.emptyList();
|
||||
|
||||
String sql = SELECT + '*' + FROM + ServerTable.TABLE_NAME +
|
||||
" WHERE (LOWER(" + ServerTable.SERVER_UUID + ") LIKE LOWER(?)" +
|
||||
WHERE + "(LOWER(" + ServerTable.SERVER_UUID + ") LIKE LOWER(?)" +
|
||||
OR + "LOWER(" + ServerTable.NAME + ") LIKE LOWER(?)" +
|
||||
OR + ServerTable.SERVER_ID + "=?" +
|
||||
OR + ServerTable.SERVER_ID + "=?)" +
|
||||
AND + ServerTable.INSTALLED + "=?" +
|
||||
" LIMIT 1";
|
||||
LIMIT + '1';
|
||||
return new QueryStatement<List<Server>>(sql) {
|
||||
@Override
|
||||
public void prepare(PreparedStatement statement) throws SQLException {
|
||||
|
@ -17,6 +17,8 @@
|
||||
package com.djrapitops.plan.storage.file;
|
||||
|
||||
import com.djrapitops.plan.delivery.web.resource.WebResource;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -64,6 +66,10 @@ public interface Resource {
|
||||
*/
|
||||
String asString() throws IOException;
|
||||
|
||||
default <T> T asParsed(Gson gson, TypeToken<T> token) throws IOException {
|
||||
return gson.fromJson(asString(), token.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Map to a WebResource used by {@link com.djrapitops.plan.delivery.web.ResourceService} APIs.
|
||||
*
|
||||
|
225
Plan/common/src/main/resources/assets/plan/geocodes.json
Normal file
225
Plan/common/src/main/resources/assets/plan/geocodes.json
Normal file
@ -0,0 +1,225 @@
|
||||
{
|
||||
"belarus": "BLR",
|
||||
"japan": "JPN",
|
||||
"gambia, the": "GMB",
|
||||
"south africa": "ZAF",
|
||||
"guinea": "GIN",
|
||||
"saint kitts and nevis": "KNA",
|
||||
"san marino": "SMR",
|
||||
"estonia": "EST",
|
||||
"dominican republic": "DOM",
|
||||
"cook islands": "COK",
|
||||
"philippines": "PHL",
|
||||
"cuba": "CUB",
|
||||
"mauritius": "MUS",
|
||||
"mali": "MLI",
|
||||
"switzerland": "CHE",
|
||||
"hong kong": "HKG",
|
||||
"armenia": "ARM",
|
||||
"vietnam": "VNM",
|
||||
"australia": "AUS",
|
||||
"laos": "LAO",
|
||||
"aruba": "ABW",
|
||||
"solomon islands": "SLB",
|
||||
"turkey": "TUR",
|
||||
"ukraine": "UKR",
|
||||
"austria": "AUT",
|
||||
"united states": "USA",
|
||||
"cambodia": "KHM",
|
||||
"monaco": "MCO",
|
||||
"hungary": "HUN",
|
||||
"kenya": "KEN",
|
||||
"greenland": "GRL",
|
||||
"greece": "GRC",
|
||||
"paraguay": "PRY",
|
||||
"palau": "PLW",
|
||||
"congo, republic of the": "COG",
|
||||
"vanuatu": "VUT",
|
||||
"cyprus": "CYP",
|
||||
"colombia": "COL",
|
||||
"azerbaijan": "AZE",
|
||||
"syria": "SYR",
|
||||
"rwanda": "RWA",
|
||||
"libya": "LBY",
|
||||
"burkina faso": "BFA",
|
||||
"guernsey": "GGY",
|
||||
"afghanistan": "AFG",
|
||||
"norway": "NOR",
|
||||
"kiribati": "KIR",
|
||||
"dominica": "DMA",
|
||||
"bulgaria": "BGR",
|
||||
"south korea": "KOR",
|
||||
"bahrain": "BHR",
|
||||
"guatemala": "GTM",
|
||||
"ghana": "GHA",
|
||||
"somalia": "SOM",
|
||||
"jamaica": "JAM",
|
||||
"togo": "TGO",
|
||||
"liechtenstein": "LIE",
|
||||
"thailand": "THA",
|
||||
"france": "FRA",
|
||||
"serbia": "SRB",
|
||||
"senegal": "SEN",
|
||||
"zambia": "ZMB",
|
||||
"comoros": "COM",
|
||||
"namibia": "NAM",
|
||||
"saint pierre and miquelon": "SPM",
|
||||
"taiwan": "TWN",
|
||||
"canada": "CAN",
|
||||
"french polynesia": "PYF",
|
||||
"bahamas, the": "BHM",
|
||||
"honduras": "HND",
|
||||
"virgin islands": "VGB",
|
||||
"maldives": "MDV",
|
||||
"chile": "CHL",
|
||||
"oman": "OMN",
|
||||
"timor-leste": "TLS",
|
||||
"brazil": "BRA",
|
||||
"guyana": "GUY",
|
||||
"lesotho": "LSO",
|
||||
"germany": "DEU",
|
||||
"india": "IND",
|
||||
"malaysia": "MYS",
|
||||
"peru": "PER",
|
||||
"trinidad and tobago": "TTO",
|
||||
"northern mariana islands": "MNP",
|
||||
"denmark": "DNK",
|
||||
"sri lanka": "LKA",
|
||||
"jersey": "JEY",
|
||||
"belize": "BLZ",
|
||||
"kuwait": "KWT",
|
||||
"slovenia": "SVN",
|
||||
"haiti": "HTI",
|
||||
"zimbabwe": "ZWE",
|
||||
"el salvador": "SLV",
|
||||
"macedonia": "MKD",
|
||||
"saint lucia": "LCA",
|
||||
"bolivia": "BOL",
|
||||
"china": "CHN",
|
||||
"falkland islands (islas malvinas)": "FLK",
|
||||
"antigua and barbuda": "ATG",
|
||||
"brunei": "BRN",
|
||||
"israel": "ISR",
|
||||
"west bank": "WBG",
|
||||
"bangladesh": "BGD",
|
||||
"czechia": "CZE",
|
||||
"ireland": "IRL",
|
||||
"albania": "ALB",
|
||||
"poland": "POL",
|
||||
"united arab emirates": "ARE",
|
||||
"botswana": "BWA",
|
||||
"andorra": "AND",
|
||||
"venezuela": "VEN",
|
||||
"marshall islands": "MHL",
|
||||
"malawi": "MWI",
|
||||
"moldova": "MDA",
|
||||
"russia": "RUS",
|
||||
"sweden": "SWE",
|
||||
"north korea": "PRK",
|
||||
"madagascar": "MDG",
|
||||
"turkmenistan": "TKM",
|
||||
"iran": "IRN",
|
||||
"iraq": "IRQ",
|
||||
"seychelles": "SYC",
|
||||
"indonesia": "IDN",
|
||||
"nicaragua": "NIC",
|
||||
"faroe islands": "FRO",
|
||||
"puerto rico": "PRI",
|
||||
"gibraltar": "GIB",
|
||||
"curacao": "CUW",
|
||||
"equatorial guinea": "GNQ",
|
||||
"ethiopia": "ETH",
|
||||
"ecuador": "ECU",
|
||||
"guinea-bissau": "GNB",
|
||||
"saudi arabia": "SAU",
|
||||
"mauritania": "MRT",
|
||||
"spain": "ESP",
|
||||
"algeria": "DZA",
|
||||
"congo, democratic republic of the": "COD",
|
||||
"american samoa": "ASM",
|
||||
"mozambique": "MOZ",
|
||||
"cameroon": "CMR",
|
||||
"portugal": "PRT",
|
||||
"costa rica": "CRI",
|
||||
"lithuania": "LTU",
|
||||
"south sudan": "SSD",
|
||||
"panama": "PAN",
|
||||
"lebanon": "LBN",
|
||||
"luxembourg": "LUX",
|
||||
"mongolia": "MNG",
|
||||
"italy": "ITA",
|
||||
"finland": "FIN",
|
||||
"bosnia and herzegovina": "BIH",
|
||||
"benin": "BEN",
|
||||
"nigeria": "NGA",
|
||||
"sudan": "SDN",
|
||||
"chad": "TCD",
|
||||
"liberia": "LBR",
|
||||
"djibouti": "DJI",
|
||||
"tajikistan": "TJK",
|
||||
"fiji": "FJI",
|
||||
"isle of man": "IMN",
|
||||
"singapore": "SGP",
|
||||
"mexico": "MEX",
|
||||
"samoa": "WSM",
|
||||
"tunisia": "TUN",
|
||||
"bhutan": "BTN",
|
||||
"uganda": "UGA",
|
||||
"uruguay": "URY",
|
||||
"gabon": "GAB",
|
||||
"british virgin islands": "VGB",
|
||||
"niger": "NER",
|
||||
"kyrgyzstan": "KGZ",
|
||||
"pakistan": "PAK",
|
||||
"cabo verde": "CPV",
|
||||
"kosovo": "KSV",
|
||||
"georgia": "GEO",
|
||||
"yemen": "YEM",
|
||||
"cayman islands": "CYM",
|
||||
"argentina": "ARG",
|
||||
"anguilla": "AIA",
|
||||
"jordan": "JOR",
|
||||
"swaziland": "SWZ",
|
||||
"burundi": "BDI",
|
||||
"slovakia": "SVK",
|
||||
"belgium": "BEL",
|
||||
"uzbekistan": "UZB",
|
||||
"tanzania": "TZA",
|
||||
"grenada": "GRD",
|
||||
"netherlands": "NLD",
|
||||
"sao tome and principe": "STP",
|
||||
"guam": "GUM",
|
||||
"eritrea": "ERI",
|
||||
"croatia": "HRV",
|
||||
"micronesia, federated states of": "FSM",
|
||||
"niue": "NIU",
|
||||
"nepal": "NPL",
|
||||
"morocco": "MAR",
|
||||
"bermuda": "BMU",
|
||||
"saint martin": "MAF",
|
||||
"suriname": "SUR",
|
||||
"burma": "MMR",
|
||||
"central african republic": "CAF",
|
||||
"romania": "ROU",
|
||||
"angola": "AGO",
|
||||
"new zealand": "NZL",
|
||||
"czech republic": "CZE",
|
||||
"sierra leone": "SLE",
|
||||
"latvia": "LVA",
|
||||
"kazakhstan": "KAZ",
|
||||
"sint maarten": "SXM",
|
||||
"cote d\u0027ivoire": "CIV",
|
||||
"egypt": "EGY",
|
||||
"united kingdom": "GBR",
|
||||
"malta": "MLT",
|
||||
"iceland": "ISL",
|
||||
"montenegro": "MNE",
|
||||
"macau": "MAC",
|
||||
"papua new guinea": "PNG",
|
||||
"tuvalu": "TUV",
|
||||
"qatar": "QAT",
|
||||
"saint vincent and the grenadines": "VCT",
|
||||
"tonga": "TON",
|
||||
"barbados": "BRB",
|
||||
"new caledonia": "NCL"
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.djrapitops.plan.delivery.rendering.json.graphs.special;
|
||||
|
||||
import com.djrapitops.plan.utilities.java.Maps;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -46,7 +47,13 @@ class WorldMapTest {
|
||||
new WorldMap.Entry("DNK", 2),
|
||||
new WorldMap.Entry("FIN", 1)
|
||||
);
|
||||
List<WorldMap.Entry> result = new WorldMap(geolocations).getEntries();
|
||||
Map<String, String> geoCodes = Maps.builder(String.class, String.class)
|
||||
.put("finland", "FIN")
|
||||
.put("sweden", "SWE")
|
||||
.put("denmark", "DNK")
|
||||
.build();
|
||||
|
||||
List<WorldMap.Entry> result = new WorldMap(geoCodes, geolocations).getEntries();
|
||||
assertEquals(expected, result);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user