Merge branch 'master' into bael-16656

This commit is contained in:
Josh Cummings
2019-10-26 15:37:05 -06:00
committed by GitHub
parent db85c8f275
commit 0be2175c89
20539 changed files with 1643630 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
/build
/bin
@@ -0,0 +1,9 @@
apply plugin :'java'
//apply plugin : 'application'
dependencies{
compile group: 'joda-time', name: 'joda-time', version: '2.9.9'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
@@ -0,0 +1,14 @@
package baeldunggreeter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Formatter {
public static String getFormattedDate() {
DateFormat dateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
Date date = new Date();
return dateFormat.format(date);
}
}
@@ -0,0 +1,23 @@
package baeldunggreetertest;
import static org.junit.Assert.assertTrue;
import java.util.Date;
import java.util.regex.Pattern;
import org.junit.Test;
import baeldunggreeter.Formatter;
public class FormatterTest {
@Test
public void testFormatter() {
String dateRegex1 = "^((19|20)\\d\\d)-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01]) ([2][0-3]|[0-1][0-9]|[1-9]):[0-5][0-9]:([0-5][0-9]|[6][0])$";
String dateString = Formatter.getFormattedDate();
assertTrue(Pattern
.matches(dateRegex1, dateString));
}
}