Commit 23bf55fa authored by Alexander Sommer's avatar Alexander Sommer
Browse files

Add usage of incrementing id rather than random one for better readability

parent 6089b821
...@@ -40,6 +40,7 @@ public class CaseCreator { ...@@ -40,6 +40,7 @@ public class CaseCreator {
pairs.add(new TestPair("login-admin tester;123123123", "OK")); pairs.add(new TestPair("login-admin tester;123123123", "OK"));
Vector<String> ids = new Vector<>(); Vector<String> ids = new Vector<>();
int idCounter = 0;
Vector<String> countries = new Vector<>(); Vector<String> countries = new Vector<>();
...@@ -55,10 +56,7 @@ public class CaseCreator { ...@@ -55,10 +56,7 @@ public class CaseCreator {
} while (countries.contains(country)); } while (countries.contains(country));
countries.add(country); countries.add(country);
String id; String id = String.format("%03d", ++idCounter);
do {
id = randomString("123456789", 3);
} while (ids.contains(id));
ids.add(id); ids.add(id);
pairs.add(new TestPair("add-ioc-code " + id + ";" + countries.elementAt(2 * i + 1) + ";" pairs.add(new TestPair("add-ioc-code " + id + ";" + countries.elementAt(2 * i + 1) + ";"
...@@ -90,10 +88,7 @@ public class CaseCreator { ...@@ -90,10 +88,7 @@ public class CaseCreator {
for (int s = 0; s < nSports; s++) { for (int s = 0; s < nSports; s++) {
athletes.add(new Vector<>()); athletes.add(new Vector<>());
for (int a = 0; a < nAthletes; a++) { for (int a = 0; a < nAthletes; a++) {
String id; String id = String.format("%03d", ++idCounter);
do {
id = randomString("0123456789", 4);
} while (ids.contains(id) || id.equals("0000"));
ids.add(id); ids.add(id);
String country = countries.elementAt(2 * random.nextInt(nCountries)); String country = countries.elementAt(2 * random.nextInt(nCountries));
athletes.elementAt(s).add(id); athletes.elementAt(s).add(id);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment