mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-23 12:52:07 +01:00
TestUtils: Set UTC timezone and add formatUTCDate()
This commit is contained in:
parent
a6e5ca898f
commit
8a4908d29d
1 changed files with 8 additions and 0 deletions
|
@ -23,10 +23,14 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
public class TestUtils {
|
public class TestUtils {
|
||||||
|
|
||||||
public static SimpleDateFormat UTC_PARSER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
|
public static SimpleDateFormat UTC_PARSER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
|
||||||
|
static {
|
||||||
|
UTC_PARSER.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
|
}
|
||||||
public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
private static final Random RANDOM = new Random();
|
private static final Random RANDOM = new Random();
|
||||||
|
|
||||||
|
@ -38,6 +42,10 @@ public class TestUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String formatUTCDate(Date date) {
|
||||||
|
return UTC_PARSER.format(date);
|
||||||
|
}
|
||||||
|
|
||||||
public static int getNumberOfItemsInIterator(Iterator<?> iterator) {
|
public static int getNumberOfItemsInIterator(Iterator<?> iterator) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
|
Loading…
Reference in a new issue