@@ -263,6 +263,7 @@ public void legalArguments() {
263263 }
264264
265265 private static final Point CIUDAD_JUAREZ = Point .fromDeg (31.7 , -106.5 );
266+ private static final Point VAALS = Point .fromDeg (50.8 , 6.0 );
266267
267268 @ Test
268269 public void testEncodeCiudadJuarez () {
@@ -273,28 +274,51 @@ public void testEncodeCiudadJuarez() {
273274 }
274275
275276 @ Test
276- public void testEncodeRestrictToCountryISO2 () {
277- LOG .info ("testEncodeRestrictToCountryISO2" );
278- final Point ciudadJuarez = Point .fromDeg (31.7 , -106.5 );
279- final List <Mapcode > mapcodesMX = MapcodeCodec .encodeRestrictToCountryISO2 (ciudadJuarez , "MX" );
280- assertEquals (5 , mapcodesMX .size ());
277+ public void testEncodeRestrictToCountryISO2CountryWithSubdivision () {
278+ LOG .info ("testEncodeRestrictToCountryISO2CountryWithSubdivision" );
279+ final List <Mapcode > mapcodesMX = MapcodeCodec .encodeRestrictToCountryISO2 (CIUDAD_JUAREZ , "MX" );
280+ assertEquals (7 , mapcodesMX .size ());
281281 assertEquals ("MX-CHH 5S.0G" , mapcodesMX .get (0 ).toString ());
282282
283- final List <Mapcode > mapcodesUS = MapcodeCodec .encodeRestrictToCountryISO2 (ciudadJuarez , "us" );
284- assertEquals (4 , mapcodesUS .size ());
283+ final List <Mapcode > mapcodesUS = MapcodeCodec .encodeRestrictToCountryISO2 (CIUDAD_JUAREZ , "us" );
284+ assertEquals (5 , mapcodesUS .size ());
285285 assertEquals ("US-NM T1DZ.338" , mapcodesUS .get (0 ).toString ());
286286 }
287287
288288 @ Test
289- public void testEncodeRestrictToCountryISO3 () {
290- LOG .info ("testEncodeRestrictToCountryISO3" );
289+ public void testEncodeRestrictToCountryISO2CountryWithoutSubdivision () {
290+ LOG .info ("testEncodeRestrictToCountryISO2CountryWithoutSubdivision" );
291+ final List <Mapcode > mapcodesNL = MapcodeCodec .encodeRestrictToCountryISO2 (VAALS , "NL" );
292+ assertEquals (2 , mapcodesNL .size ());
293+ assertEquals ("NLD ZNV.W78" , mapcodesNL .get (0 ).toString ());
294+
295+ final List <Mapcode > mapcodesBE = MapcodeCodec .encodeRestrictToCountryISO2 (VAALS , "be" );
296+ assertEquals (2 , mapcodesBE .size ());
297+ assertEquals ("BEL DRQ.PNK" , mapcodesBE .get (0 ).toString ());
298+ }
299+
300+ @ Test
301+ public void testEncodeRestrictToCountryISO3WithSubdivision () {
302+ LOG .info ("testEncodeRestrictToCountryISO3WithSubdivision" );
291303 final Point ciudadJuarez = Point .fromDeg (31.7 , -106.5 );
292- final List <Mapcode > mapcodesMEX = MapcodeCodec .encodeRestrictToCountryISO3 (ciudadJuarez , "MEX" );
304+ final List <Mapcode > mapcodesMEX = MapcodeCodec .encodeRestrictToCountryISO3 (CIUDAD_JUAREZ , "MEX" );
293305 assertEquals (2 , mapcodesMEX .size ());
294306 assertEquals ("MEX 4CMT.DLX" , mapcodesMEX .get (0 ).toString ());
295307
296- final List <Mapcode > mapcodesUSA = MapcodeCodec .encodeRestrictToCountryISO3 (ciudadJuarez , "usa" );
308+ final List <Mapcode > mapcodesUSA = MapcodeCodec .encodeRestrictToCountryISO3 (CIUDAD_JUAREZ , "usa" );
297309 assertEquals (1 , mapcodesUSA .size ());
298310 assertEquals ("USA NG4F.K745" , mapcodesUSA .get (0 ).toString ());
299311 }
312+
313+ @ Test
314+ public void testEncodeRestrictToCountryISO3CountryWithoutSubdivision () {
315+ LOG .info ("testEncodeRestrictToCountryISO3CountryWithoutSubdivision" );
316+ final List <Mapcode > mapcodesNLD = MapcodeCodec .encodeRestrictToCountryISO3 (VAALS , "NLD" );
317+ assertEquals (2 , mapcodesNLD .size ());
318+ assertEquals ("NLD ZNV.W78" , mapcodesNLD .get (0 ).toString ());
319+
320+ final List <Mapcode > mapcodesBEL = MapcodeCodec .encodeRestrictToCountryISO3 (VAALS , "bel" );
321+ assertEquals (2 , mapcodesBEL .size ());
322+ assertEquals ("BEL DRQ.PNK" , mapcodesBEL .get (0 ).toString ());
323+ }
300324}
0 commit comments