]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/dbObjects/CountryCode.java
add: random countries for tests
[gigi.git] / src / org / cacert / gigi / dbObjects / CountryCode.java
index bd22dbc1df746729d6f4d6a1ff278a13316833b9..002ae06cd9ced6df9b69bc633bd64b0896772b6a 100644 (file)
@@ -1,5 +1,7 @@
 package org.cacert.gigi.dbObjects;
 
+import java.util.Random;
+
 import org.cacert.gigi.GigiApiException;
 import org.cacert.gigi.database.GigiPreparedStatement;
 import org.cacert.gigi.database.GigiResultSet;
@@ -148,4 +150,10 @@ public class CountryCode {
         throw new RuntimeException("Internal Error: CountryCode for country not found" + this.getCountry());
     }
 
+    public static CountryCode getRandomCountry(CountryCodeType cType) {
+        CountryCode[] cc = CountryCode.getCountryCodes(cType);
+        int rnd = new Random().nextInt(cc.length);
+        return cc[rnd];
+    }
+
 }