From 982f06e8cfd378ab413616745459d2e8ba7bf944 Mon Sep 17 00:00:00 2001 From: Jacek Gajek Date: Fri, 10 Nov 2023 09:57:14 +0100 Subject: [PATCH 1/3] 807: Add new administrative area levels in the Address model This commit introduces administrative area levels 6 and 7 to the Address model. This has been added to accommodate more granular geographic divisions that some countries may have. Corresponding changes are reflected in the EnumsTest as well. --- .../com/google/maps/model/AddressComponentType.java | 10 ++++++++++ src/main/java/com/google/maps/model/AddressType.java | 10 ++++++++++ src/test/java/com/google/maps/model/EnumsTest.java | 11 +++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/google/maps/model/AddressComponentType.java b/src/main/java/com/google/maps/model/AddressComponentType.java index aa0d565d7..5bdc230aa 100644 --- a/src/main/java/com/google/maps/model/AddressComponentType.java +++ b/src/main/java/com/google/maps/model/AddressComponentType.java @@ -69,6 +69,16 @@ public enum AddressComponentType { * Not all nations exhibit these administrative levels. */ ADMINISTRATIVE_AREA_LEVEL_5("administrative_area_level_5"), + /** + * A fifth-order civil entity below the country level. This type indicates a minor civil division. + * Not all nations exhibit these administrative levels. + */ + ADMINISTRATIVE_AREA_LEVEL_6("administrative_area_level_6"), + /** + * A fifth-order civil entity below the country level. This type indicates a minor civil division. + * Not all nations exhibit these administrative levels. + */ + ADMINISTRATIVE_AREA_LEVEL_7("administrative_area_level_7"), /** A commonly-used alternative name for the entity. */ COLLOQUIAL_AREA("colloquial_area"), diff --git a/src/main/java/com/google/maps/model/AddressType.java b/src/main/java/com/google/maps/model/AddressType.java index 08157bc98..89f1c5d56 100644 --- a/src/main/java/com/google/maps/model/AddressType.java +++ b/src/main/java/com/google/maps/model/AddressType.java @@ -85,6 +85,16 @@ public enum AddressType implements UrlValue { * Not all nations exhibit these administrative levels. */ ADMINISTRATIVE_AREA_LEVEL_5("administrative_area_level_5"), + /** + * A fifth-order civil entity below the country level. This type indicates a minor civil division. + * Not all nations exhibit these administrative levels. + */ + ADMINISTRATIVE_AREA_LEVEL_6("administrative_area_level_6"), + /** + * A fifth-order civil entity below the country level. This type indicates a minor civil division. + * Not all nations exhibit these administrative levels. + */ + ADMINISTRATIVE_AREA_LEVEL_7("administrative_area_level_7"), /** A commonly-used alternative name for the entity. */ COLLOQUIAL_AREA("colloquial_area"), diff --git a/src/test/java/com/google/maps/model/EnumsTest.java b/src/test/java/com/google/maps/model/EnumsTest.java index a77d85d73..9436f30db 100644 --- a/src/test/java/com/google/maps/model/EnumsTest.java +++ b/src/test/java/com/google/maps/model/EnumsTest.java @@ -33,7 +33,7 @@ @Category(SmallTests.class) public class EnumsTest { @Test - public void testUnknown() throws Exception { + public void testUnknown() { assertNotNull(AddressComponentType.UNKNOWN); // Does not implement UrlValue. assertCannotGetUrlValue(AddressType.UNKNOWN); @@ -43,7 +43,7 @@ public void testUnknown() throws Exception { @Test public void testCanonicalLiteralsForAddressType() { - Map addressTypeToLiteralMap = new HashMap(); + Map addressTypeToLiteralMap = new HashMap<>(); // Short alias just to avoid line wrapping in the below code Map m = addressTypeToLiteralMap; m.put(AddressType.STREET_ADDRESS, "street_address"); @@ -57,6 +57,8 @@ public void testCanonicalLiteralsForAddressType() { m.put(AddressType.ADMINISTRATIVE_AREA_LEVEL_3, "administrative_area_level_3"); m.put(AddressType.ADMINISTRATIVE_AREA_LEVEL_4, "administrative_area_level_4"); m.put(AddressType.ADMINISTRATIVE_AREA_LEVEL_5, "administrative_area_level_5"); + m.put(AddressType.ADMINISTRATIVE_AREA_LEVEL_6, "administrative_area_level_6"); + m.put(AddressType.ADMINISTRATIVE_AREA_LEVEL_7, "administrative_area_level_7"); m.put(AddressType.COLLOQUIAL_AREA, "colloquial_area"); m.put(AddressType.LOCALITY, "locality"); m.put(AddressType.WARD, "ward"); @@ -203,8 +205,7 @@ public void testCanonicalLiteralsForAddressType() { @Test public void testCanonicalLiteralsForAddressComponentType() { - Map addressComponentTypeToLiteralMap = - new HashMap(); + Map addressComponentTypeToLiteralMap = new HashMap<>(); // Short alias just to avoid line wrapping in the below code Map m = addressComponentTypeToLiteralMap; m.put(AddressComponentType.STREET_ADDRESS, "street_address"); @@ -218,6 +219,8 @@ public void testCanonicalLiteralsForAddressComponentType() { m.put(AddressComponentType.ADMINISTRATIVE_AREA_LEVEL_3, "administrative_area_level_3"); m.put(AddressComponentType.ADMINISTRATIVE_AREA_LEVEL_4, "administrative_area_level_4"); m.put(AddressComponentType.ADMINISTRATIVE_AREA_LEVEL_5, "administrative_area_level_5"); + m.put(AddressComponentType.ADMINISTRATIVE_AREA_LEVEL_6, "administrative_area_level_6"); + m.put(AddressComponentType.ADMINISTRATIVE_AREA_LEVEL_7, "administrative_area_level_7"); m.put(AddressComponentType.COLLOQUIAL_AREA, "colloquial_area"); m.put(AddressComponentType.LOCALITY, "locality"); m.put(AddressComponentType.WARD, "ward"); From f9a26274ab2d7e67aca2f5d02faef532157c51bb Mon Sep 17 00:00:00 2001 From: Jacek Gajek Date: Fri, 10 Nov 2023 10:13:02 +0100 Subject: [PATCH 2/3] 807: No-op commit to pass CI check --- src/test/java/com/google/maps/model/EnumsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/google/maps/model/EnumsTest.java b/src/test/java/com/google/maps/model/EnumsTest.java index 9436f30db..4d7eae0aa 100644 --- a/src/test/java/com/google/maps/model/EnumsTest.java +++ b/src/test/java/com/google/maps/model/EnumsTest.java @@ -44,7 +44,7 @@ public void testUnknown() { @Test public void testCanonicalLiteralsForAddressType() { Map addressTypeToLiteralMap = new HashMap<>(); - // Short alias just to avoid line wrapping in the below code + // Short alias just to avoid line wrapping in the below code. Map m = addressTypeToLiteralMap; m.put(AddressType.STREET_ADDRESS, "street_address"); m.put(AddressType.ROUTE, "route"); From 5b24debbcd4ef41ef199cddbefb0fea384f4b09a Mon Sep 17 00:00:00 2001 From: Jacek Gajek Date: Fri, 10 Nov 2023 10:17:42 +0100 Subject: [PATCH 3/3] Fixes #807: Add new administrative area levels in the Address model This commit introduces administrative area levels 6 and 7 to the Address model. This has been added to accommodate more granular geographic divisions that some countries may have. Corresponding changes are reflected in the EnumsTest as well. --- src/test/java/com/google/maps/model/EnumsTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/google/maps/model/EnumsTest.java b/src/test/java/com/google/maps/model/EnumsTest.java index 4d7eae0aa..9436f30db 100644 --- a/src/test/java/com/google/maps/model/EnumsTest.java +++ b/src/test/java/com/google/maps/model/EnumsTest.java @@ -44,7 +44,7 @@ public void testUnknown() { @Test public void testCanonicalLiteralsForAddressType() { Map addressTypeToLiteralMap = new HashMap<>(); - // Short alias just to avoid line wrapping in the below code. + // Short alias just to avoid line wrapping in the below code Map m = addressTypeToLiteralMap; m.put(AddressType.STREET_ADDRESS, "street_address"); m.put(AddressType.ROUTE, "route");