From 3d093b82fc7e9da470aad55998fc817d975a69ef Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 13 Nov 2022 00:20:55 +0100 Subject: add unit test to verify the required date formatting is correct --- .../leap/bitmaskclient/base/utils/DateHelperTest.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/src/test/java/se/leap/bitmaskclient/base/utils/DateHelperTest.java (limited to 'app/src/test') diff --git a/app/src/test/java/se/leap/bitmaskclient/base/utils/DateHelperTest.java b/app/src/test/java/se/leap/bitmaskclient/base/utils/DateHelperTest.java new file mode 100644 index 00000000..c857c103 --- /dev/null +++ b/app/src/test/java/se/leap/bitmaskclient/base/utils/DateHelperTest.java @@ -0,0 +1,19 @@ +package se.leap.bitmaskclient.base.utils; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class DateHelperTest { + + @Test + public void getFormattedDateWithTimezone() { + Pattern datePattern = Pattern.compile("^10 Nov 22 11:26 [+-][0-9]{4}$"); + String formattedDate = DateHelper.getFormattedDateWithTimezone(1668075969744L); + Matcher matcher = datePattern.matcher(formattedDate); + assertTrue(matcher.find()); + } +} \ No newline at end of file -- cgit v1.2.3