X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2FdbObjects%2FTestCountryCode.java;h=7f82909c75cc1dc5763f8b210271c760029c2332;hb=9f4de8970050fd3d72af6594a1c79c327bbc0656;hp=92b169ad3ef42441a48c402af1a25c459e4c84d3;hpb=d3f2bc843552d3011a341555776fc7a77905ab55;p=gigi.git diff --git a/tests/org/cacert/gigi/dbObjects/TestCountryCode.java b/tests/org/cacert/gigi/dbObjects/TestCountryCode.java index 92b169ad..7f82909c 100644 --- a/tests/org/cacert/gigi/dbObjects/TestCountryCode.java +++ b/tests/org/cacert/gigi/dbObjects/TestCountryCode.java @@ -3,9 +3,10 @@ package org.cacert.gigi.dbObjects; import static org.junit.Assert.*; import java.util.Arrays; +import java.util.List; import org.cacert.gigi.GigiApiException; -import org.cacert.gigi.dbObjects.CountryCode.CountryCodeType; +import org.cacert.gigi.dbObjects.Country.CountryCodeType; import org.cacert.gigi.testUtils.BusinessTest; import org.hamcrest.BaseMatcher; import org.hamcrest.CoreMatchers; @@ -34,19 +35,18 @@ public class TestCountryCode extends BusinessTest { @Test public void testList() throws GigiApiException { - CountryCode[] ccs = CountryCode.getCountryCodes(type); - for (CountryCode cc : ccs) { - assertSame(type, cc.getCountryCodeType()); - assertThat(cc.getCountryCode(), stringLength(type.getLen())); + List ccs = Country.getCountries(); + for (Country cc : ccs) { + assertThat(cc.getCode(type), stringLength(type.getLen())); } } @Test public void testFetch() throws GigiApiException { String ref = type == CountryCodeType.CODE_2_CHARS ? "DE" : "DEU"; - CountryCode cc = CountryCode.getCountryCode(ref, type); - assertEquals(ref, cc.getCountryCode()); - assertEquals("Germany", cc.getCountry()); + Country cc = Country.getCountryByCode(ref, type); + assertEquals(ref, cc.getCode(type)); + assertEquals("Germany", cc.getName()); } @Test @@ -54,16 +54,16 @@ public class TestCountryCode extends BusinessTest { String ref = type == CountryCodeType.CODE_2_CHARS ? "DE" : "DEU"; String reff = type == CountryCodeType.CODE_2_CHARS ? "DF" : "DFU"; - CountryCode.checkCountryCode(ref, type); + Country.checkCountryCode(ref, type); try { - CountryCode.checkCountryCode(reff, type); + Country.checkCountryCode(reff, type); } catch (GigiApiException e) { assertThat(e.getMessage(), CoreMatchers.containsString("was wrong")); } - CountryCode.getCountryCode(ref, type); + Country.getCountryByCode(ref, type); try { - CountryCode.getCountryCode(reff, type); + Country.getCountryByCode(reff, type); } catch (GigiApiException e) { assertThat(e.getMessage(), CoreMatchers.containsString("was wrong")); } @@ -72,7 +72,7 @@ public class TestCountryCode extends BusinessTest { @Test public void testSingleInstance() throws GigiApiException { String ref = type == CountryCodeType.CODE_2_CHARS ? "DE" : "DEU"; - assertSame(CountryCode.getCountryCode(ref, type), CountryCode.getCountryCode(ref, type)); + assertSame(Country.getCountryByCode(ref, type), Country.getCountryByCode(ref, type)); } private Matcher stringLength(final int len) {